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.
Reply With Quote
  # 2  
Old 03-02-2007, 02:05 PM
Default

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

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?
Reply With Quote
  # 4  
Old 03-03-2007, 04:04 PM
Default

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?
Reply With Quote
  # 5  
Old 03-03-2007, 04:30 PM
Default

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!
Reply With Quote
  # 6  
Old 03-03-2007, 04:33 PM
Default

I will do some digging.
Reply With Quote
  # 7  
Old 03-03-2007, 06:40 PM
Default

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.
Reply With Quote
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值