Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Chrome input type="date"

I have almost no knowledge of web programming, but I have been tasked to solve something on my company's website. Apparently, I have an issue with browsers using HTML5 on a legacy site using type="date" and I need to find a way around it.

My site has a lot of date fields that the user must input like such:

 <input type="date" name="DateStart" size="15" value="8/30/2011">

In every browser we currently use except Chrome, this works just fine. Chrome is the only browser that supplies rolling buttons to scroll through the date. What I see on the back end of this is an attempt to do this:

FormatDateTime(DateStart, 2)

I get an invalid date error which means that we cannot use Chrome to fill out this form. Is there a way around this problem?

like image 941
Random_Person Avatar asked Aug 30 '11 12:08

Random_Person


People also ask

How do you change input type format to DD MMM YYYY?

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.

Does Chrome have a date setting?

The date format in Chrome is derived from the language. This is set in Chrome three-points menu : Settings > Advanced > Languages. Use the "Add language" button to choose another variant of English that corresponds to your date preference.

How do I get the input type for a date?

<input type="date"> <input> elements of type="date" create input fields that let the user enter a date, either with a textbox that validates the input or a special date picker interface. The resulting value includes the year, month, and day, but not the time.


1 Answers

Actually chrome's support for 'date' is broken. (See here). At least for the moment.

The use of 'date' in the HTML is absolutely fine - browser's which do not know of or support an input type are supposed to fallback to type='text'.

Currently chrome partially supports date, in a way that is essentially broken (it adds a couple of up-down buttons, but no datepicker.)

Of course you do need to bear in mind that if you are using type='date', and if the browser supports it, then you'll want to disable whatever datepicker support you'd otherwise be using.

UPDATE (6 Feb 2012):

It looks to me like this is now fixed. Chrome no longer claims to support input type='date', and does not provide the partially complete implementation.

UPDATE (17 Aug 2012):

Chrome does now have input type="date" support, and it's more functional this time.

like image 152
Tom Christie Avatar answered Oct 20 '22 16:10

Tom Christie