persistence.js is an asynchronous Javascript database mapper library. You can use it in the browser, as well on the server (and you can share data models between them).
I'm having an issue with persistence.sync.js regarding dates.
I have set the server to send all dates as an Epoch based string as follows:
$json = new \stdClass();
foreach ($this as $key => $value) {
if ($value instanceof \DateTime) {
$json->$key = $value->format('U');
} else {
$json->$key = $value;
}
}
return $json;
Looking at the data that is being sent, this is working as expected, with the date field being sent as an integer.
However, when persistence.sync.js reads the JSON data, the logged INSERT command is as follows:
Looking through the sync source, I can't work out where this is occurring as the correct integer value is being read in 'Step 3' (line 169). I'm guessing it's somewhere in persisting the data.
I'm having an issue with persistence.sync.js regarding dates.
I have set the server to send all dates as an Epoch based string as follows:
Looking at the data that is being sent, this is working as expected, with the date field being sent as an integer.
However, when persistence.sync.js reads the JSON data, the logged INSERT command is as follows:
(note NaN value for date field)
Looking through the sync source, I can't work out where this is occurring as the correct integer value is being read in 'Step 3' (line 169). I'm guessing it's somewhere in persisting the data.
I'm using Chrome 22.0.1201.0
Any help would be appreciated.
Regards
Hayden