View Full Version : Ext.util.Format.date question

15 Sep 2012, 8:19 AM
Why does this:

Ext.util.Format.date('2012-09-14', 'Y/m/d');

return this? 2012/09/13 and not 2012/09/14

15 Sep 2012, 9:22 AM
Not for me, on 4.1.1 - check out this jsFiddle: http://jsfiddle.net/bJ2qs/

15 Sep 2012, 9:31 AM
hmm... I just ran your fiddle and I still get same results


15 Sep 2012, 12:36 PM
Hi what browser and what ExtJS version - I tested it in Chrome, IE9, Firefox with ExtJS 4.1.1 and it worked fine

15 Sep 2012, 12:54 PM
What I use is:

For format.date, use:

Ext.util.Format.date('2012/09/14', 'Y/m/d');

For the field define for date field use:

{ name : 'date_field', type : 'date', dateFormat : 'Y-m-d' },


15 Sep 2012, 4:08 PM

The value to format. If a string is passed, it is converted to a Date by the Javascript's built-in Date.parse method.

What does Date.parse return on that string?

16 Sep 2012, 2:30 PM

returns this: 1347580800000

9 Apr 2015, 3:06 PM
This one is old but I just stumbbled in the same problem.

In my case, I realized that the problem is not the renderer, I don't know if yours really was.
My JSON comes with the correct date, but the grid shows 1 day before.
Finally, I verified that it only happens on CHROME. Using FIREFOX, the correct date is displayed.

I still don't know why Chrome does that or what the problem is.

9 Apr 2015, 11:00 PM
Most likely it's a problem with the timezone or DST. It needs someone who can reproduce the problem (I can't) to step through in the debugger to figure out where things go awry.

It is also possible that the problem will only happen at certain times of day as modifying a Date object can pick up parts of the current date/time. I recall a similar problem where the date formatters didn't function correctly on the 31st day of the month.