Results 1 to 2 of 2

Thread: Problem with date in Model

  1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    10

    Default Problem with date in Model

    Hi guys,

    I'm using MVC and REST in my newest project and I have some problem with date field. First the date value wasn't mapped from JSON (received from rest) to Model so I changed dateFormat in this field to "time" and it started to work perfect.

    But the problem is that when I use this value in form and then I want to edit the date, I can't overwrite the value from database.

    Code:
    //....
    var record = form.getRecord();
    var values = form.getValues();
    // here record.data.date is a Date object and values.date = "2012-12-12"
    record.set(values);
    // here record.data.date is a Date object with date set to 1970-01-01
    Why is that? I tried all the formats of date in the form and the value is never set in the model.

  2. #2
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,102
    Answers
    113

    Default

    It would help others to figure out the problem if you could post some code of the datefield in your form and your data model. Are you setting the format of your datefield?

    http://docs.sencha.com/ext-js/4-0/#!...ate-cfg-format

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •