spacemunkay / BikeShed

Velocipede's User, Sales, and Bike Inventory Web App
9 stars 5 forks source link

Netzke/ExtJS parses UTC dates as locale #100

Open spacemunkay opened 10 years ago

spacemunkay commented 10 years ago

As an example, a date of: Mon, 21 Apr 2014 00:01:43 UTC +00:00 gets parsed into Mon Apr 21 2014 00:01:43 GMT-0400 (EDT). Note the EDT.

This can be fixed by manually setting the format in Ext.Date.parse, however not sure how to set the parsing format for date grid columns... it appears you can only set the render format.

spacemunkay commented 10 years ago

date = Ext.Date.parse("2014-04-21 00:01:43", 'c'); Mon Apr 21 2014 00:01:43 GMT-0400 (EDT) date = Ext.Date.parse("2014-04-21 00:01:43 UTC", 'c'); undefined date = new Date("2014-04-21 00:01:43 UTC"); Sun Apr 20 2014 20:01:43 GMT-0400 (EDT)

spacemunkay commented 10 years ago

date = Ext.Date.parse("Mon, 21 Apr 2014 00:01:43 UTC +00:00", 'D, j M Y H:i:s T P'); Sun Apr 20 2014 20:01:43 GMT-0400 (EDT)

spacemunkay commented 10 years ago

Testing it out on the ExtJS date column live demo, it correctly parses the date. The issue is that Netzke calls to_json on the AR date field and it loses the time zone. Can be fixed by calling as_json instead, see: https://groups.google.com/forum/#!searchin/netzke/date/netzke/S4qq6gTd2Z0/RCkRAYLj7DoJ

spacemunkay commented 10 years ago

Attempting to address the issue in the branch, but don't have time to figure out what's going on in Netzke: https://github.com/spacemunkay/BikeShed/compare/denney-fix-saving-dates