Specifying the output of an input type value HTML5 = date?

I want to add my own date picker apps to my app that currently uses an outdated home system. Date input support is not yet widespread, but if I could present both implementations based on compatibility, that would be ideal.

Is it possible to indicate the output of the value specified by the date date parameter? The default is opera yyyy-mm-dd , and I very explicitly need dd-MMM-yyyy .

Is there any way to manage this output now?

+30
javascript jquery html5 web-standards datepicker
Aug 16 '10 at 18:46
source share
3 answers

The HTML5 input field indicates the specific value of the format used: RFC 3339 full-date

Is it possible to change the outdated date picker to use the yyyy-mm-dd format (and update the server side that reads this)?

I suppose not, so you can add some Javascript screenshot code that listens for an HTML5 input change event and updates the hidden date value field according to the format of the outdated date picker (converts yyyy-mm-dd to dd-MMM-YYYY).

+23
Aug 16 '10 at 19:32
source share

In Google Chrome, this has recently changed. The values โ€‹โ€‹displayed to the user are now based on the locale of the operating system. However, reading is therefore input.value always returns as yyyy-mm-dd regardless of presentation format.

How useful my mind is.

Source:

http://updates.html5rocks.com/2012/08/Quick-FAQs-on-input-type-date-in-Google-Chrome

+15
Aug 13 '12 at 7:22
source share

HTML date field format is standard. Although this cannot be changed, you can easily convert from a date object to the format you are looking for if your user has JavaScript enabled.

 // Converts any valid Date string or Date object into the format dd-MMM-yyyy function dateTransform(d) { var s = (new Date(d)).toString().split(' '); return [s[2],s[1],s[3]].join('-'); } 

Otherwise, you will need to send in ISO format and implement a server solution. Perhaps over time this may lead to more use of the standard date format in each locality.

0
Mar 30 '13 at 19:26
source share



All Articles