marnusw / date-fns-tz

Complementary library for date-fns v2 adding IANA time zone support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`utcToZonedTime` outputs a date in locale time

jack-rouleau-poap opened this issue · comments

Hi! We're trying to use this library to work with our dates and timezones information.

The client receives a Zulu datetime string and a timezone string.
E.G.:

const date = '2023-08-31T14:30:00.000Z'
const timezone = 'Australia/Perth' // +8

When using utcToZonedTime with these values the output has the right date and time but the wrong timezone: Thu Aug 31 2023 22:30:00 GMT-0400 (Eastern Daylight Time)

With EST being the timezone in which I find myself.

Are we misunderstanding what the function should be doing? Documentation makes it sound like the output should be the appropriate date/time in the given timezone. The date and time are good but not in the given timezone.