logoalt Hacker News

nkrisclast Sunday at 2:41 PM9 repliesview on HN

Is 03/04/2026 March 4th or the 3rd of April?

If you have an international audience that’s going to mess someone up.

Better yet require YYYY-MM-DD.


Replies

RobotToasterlast Sunday at 4:08 PM

<input type="date"> is automatically formatted based on the user's locale.

show 3 replies
hn_throwaway_99last Sunday at 6:36 PM

> Better yet require YYYY-MM-DD

This is the equivalent of requiring all your text to be in Esperanto because dealing with separate languages is a pain.

"Normal" people never use YYYY-MM-DD format. The real world has actual complexity, tough, and the reason you see so many bugs and problems around localization is not that there aren't good APIs to deal with it, it's that it's often an after thought, doesn't always provide economic payoff, and any individual developer is usually focused on making sure it "looks good" I'm whatever locale they're familiar with.

show 1 reply
anamexislast Sunday at 3:12 PM

Or:

- Use localization context to show the right order for the user

- Display context to the user that makes obvious what the order is

- Show the month name during/immediately after input so the user can verify

JoeyJoJoJrlast Monday at 1:20 AM

A partial solution is to put DD/MM/YYYY (or the appropriate format) as the input placeholder. You could also display the format as a tooltip when the input field is focused. IMO this is better than dealing with date pickers.

andailast Sunday at 2:46 PM

I've seen some that had a drop-down for the month name. But since it was native, I could type the month name and my browser selected the right one.

JoshTriplettlast Sunday at 8:16 PM

As they type it, start displaying what it is. If, as you type "03/", it says "March", and that's not what you want, you now know what format it wants.

(And yes, always accept YYYY-MM-DD format, please.)

show 1 reply
cushlast Sunday at 3:24 PM

This has a solved problem for a long time