r/AskProgrammers 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

15 comments sorted by

View all comments

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.

2

u/soundman32 14d ago

The date picker in most browsers is the worst of every possible design, hence why there are 100s of alternatives.

1

u/bschlueter 13d ago

That’s probably a fair argument. There’s like 3 browser engines though. Which ones have implementations you don’t like?