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
In #6 I switched from using UTC dates to local dates because it fixed some issues. It turns out that it might have created others though 😅, more specifically this potentially breaks UTC dates created in negative timezones.
For example, if you create a date instance like this:
new Date('2022-10-20') the browser will assume the date is an UTC date.
Date-only strings (e.g. "1970-01-01") are treated as UTC, while date-time strings (e.g. "1970-01-01T12:00") are treated as local.
The time will still be set to 0, but for the UTC time. So it will be something like this in Belgian time: 2022-10-20T02:00:00+02:00. This will still serialize properly with the current implementation.
The problem is if you execute the code in a "negative" timezone. For example if you create the same UTC date in a -4 timezone it will serialize the previous date again: 2022-10-19T20:00:00-04:00 -> 2022-10-19.
So this PR wasn't really correct either, but I'm not sure what the real solution is at this point. I'm not smart enough for timezones 😬.
The text was updated successfully, but these errors were encountered:
In #6 I switched from using UTC dates to local dates because it fixed some issues. It turns out that it might have created others though 😅, more specifically this potentially breaks UTC dates created in negative timezones.
For example, if you create a date instance like this:
new Date('2022-10-20')
the browser will assume the date is an UTC date.From the MDN docs:
The time will still be set to 0, but for the UTC time. So it will be something like this in Belgian time:
2022-10-20T02:00:00+02:00
. This will still serialize properly with the current implementation.The problem is if you execute the code in a "negative" timezone. For example if you create the same UTC date in a -4 timezone it will serialize the previous date again:
2022-10-19T20:00:00-04:00
->2022-10-19
.So this PR wasn't really correct either, but I'm not sure what the real solution is at this point. I'm not smart enough for timezones 😬.
The text was updated successfully, but these errors were encountered: