-
20 Feb 2013 12:40 AM #1
Ext.data.proxy.Sql Date type
Ext.data.proxy.Sql Date type
REQUIRED INFORMATION
Sencha Touch version tested:- ST 2.1.0
- All
- When defining a date type in a model and leaving it null, ST throws an error indicating that it can't parse the (null) date
- Create a model with a date type in it
- Create some data but don't include a value in the date field
- Save the model against a WebSQL proxy
- save the data with no errors
- Console error: Code:
Uncaught TypeError: Object [object Window] has no method 'getMonth'
Edit Ext.data.proxy.Sql (data/proxy/SQL.js) file.
On line 549 (function writeDate()), add in this bad boy:
Code:if (!date) { return null; }
So, the function goes from this:
Code:writeDate: function (field, date) { var dateFormat = field.getDateFormat() || this.getDefaultDateFormat(); switch (dateFormat) { case 'timestamp': return date.getTime() / 1000; case 'time': return date.getTime(); default: return Ext.Date.format(date, dateFormat); } },
To this:
SUCCESS!Code:writeDate: function (field, date) { if (!date) { return null; } var dateFormat = field.getDateFormat() || this.getDefaultDateFormat(); switch (dateFormat) { case 'timestamp': return date.getTime() / 1000; case 'time': return date.getTime(); default: return Ext.Date.format(date, dateFormat); } },
-
20 Feb 2013 11:46 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
Thanks for the report! I have opened a bug in our bug tracker.
Success! Looks like we've fixed this one. According to our records the fix was applied for
TOUCH-4029
in
Sprint 30.


Reply With Quote