View Full Version : [CLOSED]IE Ext.util.Format.date BUG

6 Feb 2011, 11:23 PM
Can anybody tell my why this:


throws the following error in IE 8

Error: 'Date.monthNames[...]' is null or not an object

This works fine in all other browsers.

7 Feb 2011, 1:47 AM
Run this in the console:


From the docs:

The value to format (Strings must conform to the format expected by the javascript Date object's parse() method)

Seems like IE chokes on that particular format.

7 Feb 2011, 9:46 AM
Hm, so you are saying this is a bug? Seems from the sencha docs that this format should work just fine. I ran


from the console and IE8 is producing NaN

This is Ext-3.3.1

Do you have any suggestions to work around this?


7 Feb 2011, 12:58 PM
No, it's not a bug, the docs state that the value must be in a format the browser can parse. For whatever reason, IE doesn't support that format.

You can use:

var d = Date.parseDate('2011-02-22T05:00:00', 'c');
Ext.util.Format.date(d, 'd-M-Y');

7 Feb 2011, 1:22 PM
Right, I ended up using that. Thank you.

Just curious why would Ext.util.Format.date not utilize Date.parseDate and allow passing a read format? Ext.util.Format.date already attempts that but does not account for the fact that IE is not supporting dash separators for d-m-Y. Same seems to be true for Safari.

Something like this:

date : function(v, format, readFormat) {
if (!v) {
return "";
if (!Ext.isDate(v)) {
v = Date.parseDate(v, readFormat || "c");
return v.dateFormat(format || "m/d/Y");

Anyways, thanks again.