Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make <input type="date"> display the date in localized format in Chrome?

I'm using the HTML5 <input type="date">, which in Chrome renders a rich input control displaying the date in the format MM/DD/YYYY. The problem is that my application expects input in a localized format server-side, which means MM.DD.YYYY.

Is there any way I can change the way Chrome renders and takes input from date controls?

like image 605
Nilzor Avatar asked Feb 12 '14 07:02

Nilzor


People also ask

How to set input type date in DD-MM-YYYY format using HTML?

How to set input type date in dd-mm-yyyy format using HTML ? 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.

Is there a way to force a specific date format in chrome?

Google Chrome in its last beta version finally uses the input type=date, and the format is DD-MM-YYYY. So there must be a way to force a specific format.

Why doesn't Google Chrome have a [type=date] option for input?

Not only Google Chrome but also iOS Safari, the BlackBerry browser, and Opera have their own UI for input [type=date], and there is currently no way to achieve a unified UI on all platforms using input [type=date].

What is the use of input type date in HTML?

HTML &lt;input type="date"&gt; 1 Definition and Usage. The <input type="date"> defines a date picker. The resulting value includes the year, month, and day. 2 Browser Support. The numbers in the table specify the first browser version that fully supports the element. 3 Syntax


1 Answers

  1. Chrome renders the date on the format for the language configured in Settings > Language:

    Chrome language settings

  2. Chrome (and other browsers) always post dates in RFC 3339-format according to the HTML5 standard. Make sure the server accepts date on that format only.

like image 166
Nilzor Avatar answered Oct 04 '22 12:10

Nilzor