I've been using this module for months and recently updated to v3. Since then I can't seem to get a timestamp to show up in any other timezone.
If i provide a timestamp with the format of '2024-08-20T19:07:45.603000' and try to convert it it EST (using 'America/New_York')
I get something like this: "Tue Aug 20 2024 19:07:45 GMT-0500 (Central Daylight Time)}".
I have tried toZonedTime, fromZonedTime, and format and all solo and in combination with an initial conversion to UTC & gathering the offset and subtracting the offset in milliseconds. No matter what I end up with my local time at the end.
Running new Date('2024-08-20T19:07:45.603000') coerces the timezone into my local time on a browser, but not in node. I don't know if this is a new update to the Date initializer, but the result is that I can't get my times to be recognized in the correct timezone (they actually are in 'America/New_York' time).
I suspect this issue may be due to the use of new Date() in the date-fns-tz library. At this point I've had to look into Luxon and other libraries for this, but I was really enjoying the module and I'm really confused as to why this is happening.
I've been using this module for months and recently updated to v3. Since then I can't seem to get a timestamp to show up in any other timezone.
If i provide a timestamp with the format of '2024-08-20T19:07:45.603000' and try to convert it it EST (using 'America/New_York') I get something like this: "Tue Aug 20 2024 19:07:45 GMT-0500 (Central Daylight Time)}".
I have tried toZonedTime, fromZonedTime, and format and all solo and in combination with an initial conversion to UTC & gathering the offset and subtracting the offset in milliseconds. No matter what I end up with my local time at the end.
Running new Date('2024-08-20T19:07:45.603000') coerces the timezone into my local time on a browser, but not in node. I don't know if this is a new update to the Date initializer, but the result is that I can't get my times to be recognized in the correct timezone (they actually are in 'America/New_York' time).
I suspect this issue may be due to the use of new Date() in the date-fns-tz library. At this point I've had to look into Luxon and other libraries for this, but I was really enjoying the module and I'm really confused as to why this is happening.