I am converting a Data Object to JSON and back with JSON.stringify
and JSON.parse
.
This works great, on all devices but on Samsung Galaxy SII where for the line:
console.log(jsonObj.gebDat+"::"+new Date(jsonObj.gebDat));
I get the output:
1973-07-01T10:49:25.134Z::Invalid Date
I am implementing this exactly like at this answer, and it works for most devices, am I doing something wrong??
UPDATE
to clarify the question. I create a String calling
var stringToSave = JSON.stringify({gebDat: dataclass.gebDat, <here are some more variables>});
then I save it. Later, I load the string and parse it with
var jsonObj = JSON.parse(stringToSave);
then, I try to set my date again (calling a log just before that line) with
console.log(jsonObj.gebDat+"::"+new Date(jsonObj.gebDat));
this.gebDat = new Date(jsonObj.gebDat);
The log gives me the invalid date as shown above, and when I represent the Date it displays NaN.NaN.NaN
instead of the expected 01.07.1973