There are times (no discernible pattern) when date/time values are returned like "2014-01-12 00:00:00". Without the "T" to split the date and time, conversion fails. This fixes it:
``` javascript
function dateToJsonObject(s) {
if (s.charAt(10) == " ") {
s = s.slice(0, 10) + "T" + s.slice(11, s.length);
}
return new Date(s);
}
```
In userToJsonObject, the userId wasn't set correctly. Changed from:
``` javascript
userId: thisUser.Id,
```
to
``` javascript
userId: thisUser.id,
```
``` javascript
function dateToJsonObject(s) {
if (s.charAt(10) == " ") {
s = s.slice(0, 10) + "T" + s.slice(11, s.length);
}
return new Date(s);
}
```
In userToJsonObject, the userId wasn't set correctly. Changed from:
``` javascript
userId: thisUser.Id,
```
to
``` javascript
userId: thisUser.id,
```