I'm using an <input type="date">
element. Can I assume that the value attribute always needs to be in the format: "yyyy-MM-dd"?
That is, regardless of the region/country that the browser is being used?
I'm using an <input type="date">
element. Can I assume that the value attribute always needs to be in the format: "yyyy-MM-dd"?
That is, regardless of the region/country that the browser is being used?
Yes. The value attribute always has the format: YYYY-MM-DD
. However, the presentation format is different depending on the user's locale. See my answer here for further details.
Yes, David Walschots wrote in his answer here:
Wire format The HTML5 date input specification refers to the RFC3339 specification, which specifies a full-date format equal to: yyyy-mm-dd. See section 5.6 of the RFC3339 specification for more details. so if you want to set
max
ormin
you can use the formatY-m-d
for example 2000-01-01Presentation format Browsers are unrestricted in how they present a date input. At the time of writing Chrome, Edge, Firefox and Opera have date support (see here). They all display a date picker and format the text in the input field.
... but inconsistently use slashes (30/01/2018) where for example dashes (30-01-2018) are expected by the locale's calendar format.