If I pass the unaltered string returned by the database to the Date constructor, all calls to the Date functions such as getHours() and getDate() return NaN. The Date constructor only parses the datetime string correctly if I add the T and Z into the string. This has been true for both Firefox and IE in both Windows 7 and Windows 8.1. This behavior has persisted through 3 separate apps.
In every test it has not worked unless I modify the database string like this:
function correctApperyDateStringFormat(str) {
var dt = str.split(' ');
return dt[0] + 'T' + dt[1] + 'Z';
}
So I must create all Date objects from database datetime strings like this:
var dt = new Date(correctApperyDateStringFormat(value));
Or else the Date object will be invalid.