View Full Version : Problem with date in Model

21 Oct 2012, 10:48 PM
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.

var record = form.getRecord();
var values = form.getValues();
// here record.data.date is a Date object and values.date = "2012-12-12"
// 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.

21 Oct 2012, 11:53 PM
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?