I have a field in my Parse object set as Date. The object also has automatically added fields createdAt, updatedAt.
The response from the REST API looks like this
{"results":[
{
"createdAt":"2015-07-22T08:50:29.890Z",
"updatedAt":"2015-07-22T08:50:29.890Z",
"startDate":{"__type":"Date","iso":"2015-08-04T14:00:00.000Z"}
}
]}
All three fields are of type Date. However, their representation varies and it breaks the serializer.
I also noticed that they behave differently in the data browser.
Is this by design or am I doing something wrong?
"startDate": {
"__type": "Date",
"iso": "2015-08-04T14:00:00.000Z"
}
The above format is ISO date format. Parse supports ISO and all JS date formats (like the other ones). While we send data to Parse, it expects the date to be in ISO format.
You can parse the ISO date into JS format like this:
var startDate = new Date(results.startDate.iso);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With