-
18 Jul 2012 3:35 AM #1
[4.1.1] data.Writer sends invalid timestamps to server!
[4.1.1] data.Writer sends invalid timestamps to server!
Possibly related to: http://www.sencha.com/forum/showthread.php?215628-JSON-Dates-and-REST-Proxy-Sync
Synopsis:
- Any browser.
- Ext 4.1.1 (was working fine on Ext 4.0.x)
- A store with a proxy and a writer (tested with 'rest' and 'json' reader/writer, but that's actually irrelevant).
- A model with 1 or more fields defined as type: 'date', dateFormat: 'timestamp' (still valid per docs)
- When syncing store, writer sends garbled dates to server - i.e. "fooDate":"310007e0031am07p"
data/writer/Writer.js:116:
Code:for (f = 0; f < fLen; f++) { field = fieldItems[f]; if (field.persist) { name = field[nameProperty] || field.name; value = record.get(field.name); if (field.serialize) { data[name] = field.serialize(value, record); } else if (field.type === Ext.data.Types.DATE && field.dateFormat) { data[name] = Ext.Date.format(value, field.dateFormat); } else { data[name] = value; } } }
- Reader accepts and understands dateFormat of "time" and "timestamp".
- Writer takes literal dateFormat and passes it to Ext.Date.format() which serializes to invalid, unreadable dates.
It's a Date.format equivalent of unix timestamp (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.Date)Code:// dateFormat: 'timestamp', // replace with the one below: dateFormat: 'U'
ps: guys, could I count on a discount for 1 dev pack if I sent you a patch and a test case ? :-)Last edited by Artur Bodera (Joust); 20 Jul 2012 at 12:20 AM. Reason: title
-
20 Jul 2012 8:29 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,656
- Vote Rating
- 435
I think the docs are just a little misleading. 'timestamp' and 'time' aren't valid values, the formats listed in Ext.Date are valid. The date being sent isn't garbled, it's thinking each letter is a different format. The ones that aren't formatted aren't valid.
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.
-
20 Jul 2012 8:35 AM #3
Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTJSIV-6826
in
4.1.2.


Reply With Quote