-
25 May 2012 9:02 AM #1
JSON encodeDate time zone
JSON encodeDate time zone
Is there a reason that the timezone or at least the offset isn't included in the JSON encodeDate by default?
Just curious if I'm missing something by overriding it since it's a global override.
Thanks
Bob
-
28 May 2012 6:04 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
returnsCode:Ext.JSON.encodeDate(new Date())
encodeDate method is:Code:2012-05-28T09:03:30
Code:this.encodeDate = function(o) { return '"' + o.getFullYear() + "-" + pad(o.getMonth() + 1) + "-" + pad(o.getDate()) + "T" + pad(o.getHours()) + ":" + pad(o.getMinutes()) + ":" + pad(o.getSeconds()) + '"'; };Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
28 May 2012 6:43 AM #3
Right, I was just wondering why the timezone isn't in the default implementation? Seems like if you are using JSON you are likely transmitting it to somewhere and that somewhere would want the timezone included. I could see it if it was UTC(GMT) time so you could assume that but it's not.
I just didn't want to override encodeDate to include timezone and then wind up messing up a bunch of things since it's a global function.
Thanks
Bob


Reply With Quote