Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 435
user2014346 Avatar asked Jan 26 '13 20:01

user2014346


1 Answers

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?

like image 136
Offbeatmammal Avatar answered Oct 31 '22 05:10

Offbeatmammal