I want to know if there is a way to change HTML input type="date"
element from this:
to something like:
mm.dd.yyyy
So I want to know how to change the separator.
Is there a way to do this or should I use some custom date component ?
I want to know if there is a way to change HTML input type="date"
element from this:
to something like:
mm.dd.yyyy
So I want to know how to change the separator.
Is there a way to do this or should I use some custom date component ?
Try this.
<input id="date" type="date" value="2017-06-01">
Note that its also depends on browser potentional website user is using. :)
You need pattern
attrib in your input to match your desired format however not all browsers support that. Workaround is to use input="text"
instead and then use your custom code.
As per MDN:
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. For example, try viewing the following example in a non-supporting browser:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date
pattern
: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-pattern