prantlf / date-fns-timezone

Parsing and formatting date strings using IANA time zones for date-fns.
MIT License
137 stars 18 forks source link

Fix convert to local time across dst #24

Open gkostov opened 1 year ago

gkostov commented 1 year ago

Hey,

I ran into an issue when trying to convert a local date which has its moment after the DST switch point of the target time zone but the converted date is really before the DST switch.

For me that was the 1st of Oct 2023 in Australia/Melbourne but it really happens for any similar use case. The moment of 1st Oct locally here (UTC+3) is already DST-off in Melbourne, but at the moment of 1st of Oct in Melbourne DST is still on.

This PR has the fix together with a good bunch of tests around it. And the PR also updates "npm-run-all" which is rather old and can not install due to a hacked and deleted dependency.

Cheers