HTML5 input type date shows the format of date as specified in the system. I want to change that for everyone without changing my system date format.
Asked
Active
Viewed 827 times
1 Answers
0
Not possible.
the <input type=date...>
will pick up the client system default date format but will always store the value in ISO format (yyyy-mm-dd
)
Taken from MDN:
... as we mentioned earlier, with a date input, the actual value is always normalized to the format yyyy-mm-dd.
One way around this is to put a pattern attribute on your date input.
Even though the date input doesn't use it, the text input fallback will.
<input type="date" required pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}">
The best way to deal with dates in forms in a cross-browser way at the moment is to get the user to enter the day, month, and year in separate controls (
<select>
elements being popular; see below for an implementation), or to use a JavaScript library such as jQuery date picker.

Community
- 1
- 1

CodeWizard
- 128,036
- 21
- 144
- 167