I'd like to add native date pickers to my application, which currently uses a legacy, home-rolled system. Date input support isn't widespread, yet, but if I could present both implementations based on compatibility, that would be ideal.
Is there any way to specify the output of the value given by an HTML datepicker? The default for opera is yyyy-mm-dd
, and I very explicitly need dd-MMM-yyyy
.
Is there any way to control this output, currently?
The <input type="date"> defines a date picker. The resulting value includes the year, month, and day.
The max attribute specifies the maximum value (date) for a date field. Tip: Use the max attribute together with the min attribute to create a range of legal values. Tip: To set or return the value of the min attribute, use the min property.
To set and get the input type date in dd-mm-yyyy format we will use <input> type attribute. The <input> type attribute is used to define a date picker or control field. In this attribute, you can set the range from which day-month-year to which day-month-year date can be selected from.
The HTML5 date input field is specific about the format it uses: RFC 3339 full-date
Is it possible to change the legacy date picker to use yyyy-mm-dd format (and update the server side that reads that)?
I assume not, so then you can add some Javascript glue code that listens for a change event on the HTML5 input and updates a hidden date value field to match the format of the legacy date picker (converts yyyy-mm-dd to dd-MMM-yyyy).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With