Hacker News new | ask | show | jobs
by freeopinion 2773 days ago
JSON.parse of an ISO string yields a string, not a date.

let d = new Date(); let s = JSON.parse(JSON.stringify(d));

s will not be a clone of d.

1 comments

I never said that JSON.parse yields a date by default. But it can.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

The article says it does not return a ISO string. I'm saying it does. The author as agreed with me and will update the article.