Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-4029 in a recent build.
  1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    7
    Vote Rating
    0
    pixelated is on a distinguished road

      0  

    Default Ext.data.proxy.Sql Date type

    Ext.data.proxy.Sql Date type


    REQUIRED INFORMATION




    Sencha Touch version tested:
    • ST 2.1.0
    Browser versions tested against:
    • All
    Description:
    • 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
    Steps to reproduce the problem:
    • 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
    The result that was expected:
    • save the data with no errors
    The result that occurs instead:
    • Console error:
      Code:
      Uncaught TypeError: Object [object Window] has no method 'getMonth'
    FIX:
    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:
    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);
        }
    },
    SUCCESS!

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,620
    Vote Rating
    817
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Thanks for the report! I have opened a bug in our bug tracker.

Thread Participants: 1

Tags for this Thread