I totally agree with TJ.
If you are doing any editing, prefilling, or dynamically adjusting date values, you also need to know that with 7/3/13 Chrome only follows the standard ISO date format (yyyy-mm-dd) . It will display dates for the user in a local format ("mm / dd / yy" for the USA), but will ignore any values set in HTML that do not conform to the ISO standard.
To convert to page loading, you can use the TJ UI user sniffer and do this:
if (navigator.userAgent.indexOf('Chrome/2') != -1) { $('input[type=date]').each(function(){ var d = trim(this.getAttribute('value')); if (d){ d = new Date(d); var dStr = d.toISOString().split('T')[0]; this.value = dStr; } }); }
If, for example, you choose to disable the native datepicker and use jQuery, you will also need to set the date format according to the Chrome date field or will not display the input that the jQuery date picker sends
$('#myDate').datepicker({dateFormat: 'yy-mm-dd'});
Add these two things to the first answer variant of TJ, and you have jQuery datepicker working in Chrome without errors!
Relying on native date pickers is the perfect solution. But when you need something that supports strike-out dates, date ranges, or you just want it to look prettier, it will work.
Jon Weers Jul 02 '13 at 22:47 2013-07-02 22:47
source share