You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, to compute the UTC date, yaml.jsadds the time zone offset found in a date literal to the date. Therefore, 2017-01-01T10:00:00+05:00 is parsed as 2017-01-01T15:00:00.000Z:
This is wrong because +05:00 means the date is written in the local time of the UTC+5 time zone, meaning one should subtract five hours from the local time to get the UTC time (see e.g. https://www.w3.org/TR/NOTE-datetime).
For reference, here's the Date constructor handling the offset correctly:
$ node -p "new Date('2017-01-01T10:00:00+05:00')"
2017-01-01T05:00:00.000Z
The text was updated successfully, but these errors were encountered:
Currently, to compute the UTC date,
yaml.js
adds the time zone offset found in a date literal to the date. Therefore,2017-01-01T10:00:00+05:00
is parsed as2017-01-01T15:00:00.000Z
:This is wrong because
+05:00
means the date is written in the local time of theUTC+5
time zone, meaning one should subtract five hours from the local time to get the UTC time (see e.g. https://www.w3.org/TR/NOTE-datetime).For reference, here's the
Date
constructor handling the offset correctly:The text was updated successfully, but these errors were encountered: