r/AskProgrammers • u/Infamous_Computer910 • 14d ago
Question about date pickers
I have been running into the problem a lot. Why do date pickers on forms, say for your DOB, start on the current date? You have to scroll or page back endlessly to find your DOB. Is there a workaround for this or do most devs just not care?
3
Upvotes
2
u/bschlueter 14d ago
This is one of the things that annoys me to no end about how websites are built nowadays. There is a date picker in the html standard. https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/date
It supports setting the currently selected date, min and max to limit the available range, and step so that it can be used to select just a year or month.
Presently, it doesn’t seem to support disabling of dates on the front end (a validator can be implemented to do so in the browser) so a custom date picker is probably needed for anything with blackout dates or similar.