dateFormat with timezone - Ext JS

If I create JSON data on server in this format:
2007-03-02T15:00:00+01:00
and have my data record specified with type 'date' and dateFormat:
Y-m-d\\TH:i:sO
then the output is blank.

If I create JSON data on server in this format:
2007-03-02T15:00:00
and have my data record specified with type 'date' and dateFormat:
Y-m-d\\TH:i:s
then the output is shown but in wrong timezone.
  # 2  
03-02-2007, 02:05 PM

Eliminating the complexity of the grid and default renderers, can you confirm this behavior when using the Extified Date object by itself?
  # 3  
03-02-2007, 04:00 PM

var date = Date.parseDate('2007-03-02T15:00:00+01:00', 'Y-m-d\\TH:i:sO');
Returns null

var date = Date.parseDate('2007-03-02 15:00:00+01:00', 'Y-m-d H:i:sO');
Returns null

var date = Date.parseDate('2007-03-02 15:00:00', 'Y-m-d H:i:s');
alert(date);
Returns "Fri Mar 2 15:00:00 UTC+0100 2007"

var date = Date.parseDate('2007-03-02 15:00:00', 'Y-m-d H:i:s');
alert(date.getGMTOffset());
Returns "+-100"

Doesn't it look weird?
  # 4  
03-03-2007, 04:04 PM

var date = Date.parseDate('2007-03-02T15:00:00+01:00', 'Y-m-d\\TH:iO');

You have a colon in your timezone info which is not supported. It should be:

2007-03-02T15:00:00+0100

I can look at adding support for it (since I think that's how ISO does it?). Would it be easier for you to remove the colon?
  # 5  
03-03-2007, 04:30 PM

Sure I can remove the colon; I just read some ISO 8601 docs and what I did with the colon is the 'extended' format, where the 'basic' format does not have a colon. This doesn't bother me for now...

However...
It now outputs the dates... except that if my server-generated date/time is:

"2006-09-09T22:56:08 +0100"

then it says

"Sat Sep 09 2006 22:56:08 GMT +0200"

in the grid. Notice the timezone!
  # 6  
03-03-2007, 04:33 PM

I will do some digging.
  # 7  
03-03-2007, 06:40 PM

Jack I just tried to output this date/time on my server to two different fields:

"2006-09-09T22:56:08 +0100"

and when renderen in the columns it shows:

"Sat Sep 09 2006 22:56:08 GMT +0200"
"Sat Sep 09 2006 22:56:08 GMT +0100"

in the grid. Notice the timezone! This is the case for all records down the grid... +0200 in the first column and +0100 in the second.

你可能感兴趣的:(json,ext)