Open janhesters opened 4 days ago
Having similar issues, in converting code from moment.js that is determining whether multiple dates have the same hour across DST.
// Two dates with different hours in UTC, but should be the same hour
// when set to an American timezone because of DST
console.log(format('2021-03-09T10:00:00Z', 'E HH mm', { in: tz('America/New_York') }));
console.log(format('2021-04-06T09:00:00Z', 'E HH mm', { in: tz('America/New_York') }));
console.log(format('2021-03-09T10:00:00Z', 'E HH mm', { in: tz('America/Los_Angeles') }));
console.log(format('2021-04-06T09:00:00Z', 'E HH mm', { in: tz('America/Los_Angeles') }));
Actual:
// Is just outputting the values in UTC
Tue 10 00
Tue 09 00
Tue 10 00
Tue 09 00
Expected:
Tue 05 00
Tue 05 00
Tue 02 00
Tue 02 00
I'm trying to set the time of a date in a specific timezone:
Basically I want a function, that given a
TZDate
and a time inHH:mm
, sets that time on the date, but preserves the date in the timezone.Here is the code I wrote:
Actual
Expected