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
I was debugging, and wrote the following jest test:
describe('utcToZonedTime',()=>{constdate=newDate(Date.UTC(2023,8,1));test('converting to UTC has no effect',()=>{constutc=utcToZonedTime(date,'UTC');expect(utc.toISOString()).toEqual(date.toISOString());});});
This test fails with the following result
● utcToZonedTime › converting to UTC has no effect
expect(received).toEqual(expected) // deep equality
Expected: "2023-09-01T00:00:00.000Z"
Received: "2023-09-01T04:00:00.000Z"
My local time zone is -4:00, which makes sense if this is adding 4 to convert to "UTC". But shouldn't this function assume the provided date is in UTC already, and not the client time zone?
The text was updated successfully, but these errors were encountered:
I just discovered this same issue while writing a test. It doesn't matter what format I pass it, even an ISO formatted string like '2023-09-01T00:00:00.000Z', it always assumes the provided date is my local time zone. I hope there are some plans to address this
I was debugging, and wrote the following jest test:
This test fails with the following result
My local time zone is -4:00, which makes sense if this is adding 4 to convert to "UTC". But shouldn't this function assume the provided date is in UTC already, and not the client time zone?
The text was updated successfully, but these errors were encountered: