user2014346
user2014346

Reputation: 121

How to change the display format of the automatic datepicker in html5

Google Chrome shows a datepicker when the <input type=date> is used (chrome V20+). The date shown in the field has a dd-mm-yy format. However, for this webpage I NEED the dd-mm-yyyy format.

The 4-digit year format is crucial for the user who enters data (eg it both shows 1745 and 1945 as '45', this is quite dangerous for some uses) on this page.

Is there a way to force Chrome (and other browsers) to show the format chosen by the developper of the website, instead of the locale? Thanks, Mike

Upvotes: 12

Views: 16291

Answers (1)

Offbeatmammal
Offbeatmammal

Reputation: 8226

The HTML5 spec doesn't provide a way to work around this. Your best option would be to use jQuery/jQueryUI (which gives you more control) - http://api.jqueryui.com/datepicker/#entry-examples

See also Is there any way to change input type="date" format?

Upvotes: 6

Related Questions