View Full Version : [CLOSED] Ext.util.Format incorrectly parsing some dates

6 Dec 2013, 2:26 PM
Ext version tested:

Ext 4.2.1 rev 883
Browser versions tested against:

Safari 7.0
Chrome 31.0.1650.63

Ext.Date.parse() is returning the wrong value for certain ISO8601 date strings.
Steps to reproduce the problem:

Try to parse 2013-12-4 and 2013-12-11
The result that was expected:

Expected Dec 4 and Dec 11
The result that occurs instead:

Returned Dec 4 and Dec 10

6 Dec 2013, 2:32 PM
When I run that fiddle I see Dec-4 & Dec-11.

6 Dec 2013, 2:45 PM
Looks like a TZ thing, when I modify it to be a US based TZ then I can see Dec-10.

However this isn't really a bug. The problem is that when you pass a string to format(), it has to use the native Date.parse() browser method to determine the date. Compare:

console.log(new Date(Date.parse('2013-12-11')));
console.log(Ext.Date.parse('2013-12-11', 'Y-m-d'));

If you want to have it be consistent, you need to pass it through Ext.Date.parse() first.

6 Dec 2013, 3:46 PM
Okay, thanks. I'll be sure to explicitly parse it first.