Closed JensSpanier closed 1 year ago
Hey @JensSpanier, thank you for your PR! I'll take a deep look at it very soon, but at a first look, it looks already promising!
In the meanwhile I'd like to thank you for your contribution!
Released in v3.1.0 🎉 Thank you very much @JensSpanier !
Description
Currently date conversion is not handled right if the timezone is different to UTC (Z).
Example: I live in Germany (currently UTC+02:00). So if my local time is 12:00, it's 10:00 in UTC. The correct representation of this time as W3C (ISO 8601) string is
2023-08-08T10:00:00Z
or2023-08-08T12:00:00+02:00
.But if I call
dateToW3CString
with a date created withnew Date()
it's converted to2023-08-08T12:00:00Z
. But thats 14:00 in my timezone. WithtoISOString
it's correctly2023-08-08T10:00:00.000Z
.So instead of using this complex and incorrect way to convert a Date to a W3C (ISO 8601) string, we should use the built-in function
toISOString
.Check relevant checkboxes
npm test
) and they passed