by mathieuh · 7y ago · 0 comments
I do work for GDS and while we offer a date picker for date fields in the app I work on, we also have three day/month/year fields, because date pickers are terrible for accessibility and we would fail assessment.
So is having one field that tries to magically parse what you mean into a date. Just let the user enter the numbers they want, and return a 400 when they post the form if the numbers don't make sense.
Imagine if you're blind and you try and enter a date into those `dd/mm/yyyy/` magic fields
Yep - I actually use strategy this and type="date" both depending on what the precision requirements are =)
I've always seen the "three-field" old-school method as the most bullet-proof approach for this. Plus, validation becomes super easy since you're just doing simple integers w/ranges.
> Imagine if you're blind and you try and enter a date into those `dd/mm/yyyy/` magic fields
100% - those things absolutely break down for screen reading tech/etc. That's also why I hate these sort of "input masking" libs... accessibility is a huge concern of mine.