Date.prototype.toJSON()
Unfortunately using a date type toJSON() result is not accurate. It first apply client timezone and then convert it to json string. In my scenario I am simply read from a… (funda kabanzi)
Unfortunately using a date type toJSON() result is not accurate. It first apply client timezone and then convert it to json string. In my scenario I am simply read from an API which return a none standard datetime string without its timezone (like "2020-11-21 00:00:00"), Then I try to convert it to a date using new Date("2020-11-21 00:00:00"). Then I use it in another web service but it apply my client timezone when I use JSON.stringify() method (or toJSON()). Does this behaviour is intentionally?
I read the other same question but I am not okay with it. https://support.mozilla.org/en-US/questions/1414380