trentrichardson / jQuery-Timepicker-Addon

Adds a timepicker to jQueryUI Datepicker
http://trentrichardson.com/examples/timepicker/
MIT License
2.66k stars 1.05k forks source link

Fails to parse valid ISO-8601 time in IE8, or IE9 in IE8 compatibility mode #690

Open burnchar opened 10 years ago

burnchar commented 10 years ago

Actual date string: 2004-11-14T17:00:00

As parsed by TimePicker: 2014-02-06TaN:aN:aN

IE8 console log: LOG: Error creating Date object from string. LOG: Error parsing the date/time string: Missing number at position 0 date/time string = NaN-NaN-NaNT00:00:00 timeFormat = HH:mm:ss dateFormat = yy-mm-dd LOG: Error parsing the date string: Extra/unparsed characters found in date: TaN:aN:aN date string = 2014-02-06TaN:aN:aN date format = yy-mm-dd LOG: Error parsing the date/time string: Wrong time format date/time string = 2014-02-06TaN:aN:aN timeFormat = HH:mm:ss dateFormat = yy-mm-dd

Options: timeFormat = 'HH:mm:ss' dateFormat = $.datepicker.ISO_8601 separator = 'T' changeMonth: true changeYear: true parse: Tried both strict and loose

Versions: TimePicker v1.4.3 JQuery 1.10.2 JQueryUI 1.10.3

Works fine in recent Chrome, FF, and IE9 when not in IE8 compatibility mode.

trentrichardson commented 10 years ago

Does it work properly if you use timeFormat: "H:m:s"? The difference is padding with 0's when HH:mm:ss by use of .slice(-2). That should work in IE, but it is IE after all... If that works then it will give some direction of where the problem is. I don't have IE 8/9 available at the moment..

Ecosmose commented 10 years ago

Hye burnchar and Richard !

I try datetimepicker in jqGrid ... with an international web site (10 users )

The way that burn use the ISO 8601 is a good approach ..

$(element).datetimepicker({ dateFormat: $.datepicker.ISO_8601 , timeFormat: 'H:''m:sZ' //-> Be careful here, the no '' character in the format definition string because the forum draw a smiley like this :m: !!! , separator : 'T' , timezoneList: [ { value: 660, label: 'N.Caledonie'}, { value: 240, label: 'La Réunion' }, { value: 60, label: 'Métropole' }, { value: -240, label: 'Caraïbes' } ] })

And Yes, It works with the only 'H:''m:sZ' timeformat ... But the international norme inivit us to drawn '0' (zero) letter ( 1hrs in the morning = 01:00) ... As in the wiki page [French (I am ^^) ] http://fr.wikipedia.org/wiki/ISO_8601 [Eng] http://en.wikipedia.org/wiki/ISO_8601

Ecosmose commented 10 years ago

AH ! And this is the same problem in chrome and mozilla ... the padding of the '0' doesn't work (exemple I use HH:''mm:ssZ' , then I put 02:02:02 with the datetimepicker UI the date is correctly set in the input text ..) then, I want to (re)-open the datetimepicker UI and the Slicer and date are setted to 0 !

Ecosmose commented 10 years ago

In chrome here are the log :

Error parsing the date string: Extra/unparsed characters found in date: T04:08:06+0100
date string = 2014-02-14T04:08:06+0100
date format = yy-mm-dd

burnchar commented 10 years ago

I am on a different task, but I will do further testing shortly. Apologies for taking a while to respond.

Ecosmose commented 10 years ago

No problem ! don't need to apologize when you work ^^

I think that the slicers introduce an error when they try to read the Hour, Mins and Seconds (the famous padding)... When I use the datetimepicker , I success to set this Hours, Mins, Secs and whith the slicers also....

burnchar commented 10 years ago

This is strange, for some reason I can't make the date work in any format. I've even tried the TimePicker default of HH:mm, with no separator and with a space as a separator, and get the same problem. For example, Date string: 2004-11-14 17:00 separator: 'b' timeFormat: 'HH:mm' dateFormat: $.datepicker.ISO_8601

Log is as follows: LOG: Error creating Date object from string. LOG: Error parsing the date/time string: Missing number at position 0 date/time string = NaN-NaN-NaN 00:00 timeFormat = HH:mm dateFormat = yy-mm-dd

Ecosmose commented 10 years ago

[quote user="trentrichardson"] If that works then it will give some direction of where the problem is. [/quote]

Any News ?

Ecosmose commented 10 years ago

[quote user="burnchar "] .... separator: 'b' .... [/quote]

Why do you use 'b' separator in ISO8601 ?

burnchar commented 10 years ago

I was just trying out a different character while attempting to work around the problem.

Ecosmose commented 10 years ago

I find it ! There was some spaces behind the rest of the datetime value in the altfield .. i delete the space (invisible) characters and all is fine !