dayjs icon indicating copy to clipboard operation
dayjs copied to clipboard

DayJS Timezone Bug with Daylight Savings

Open giavinh79 opened this issue 1 year ago • 2 comments

Describe the bug Unexpected results (deviation between moment and dayjs output) using dayjs.tz() or dayjs().tz(timezone, true) when it's daylight savings and the dayjs timezone is behind the user's local timezone (i.e. March 10th, 2024 in a EST local timezone while the dayjs timezone is set to a timezone behind that).

Here's a sandbox to showcase the behaviour described above: https://stackblitz.com/edit/react-smshgm-7ldb1m?file=Demo.tsx

Expected behavior Expected similar behaviour as moment in regards to timezones.

If I pass in a date like 2024-03-10 to dayjs in the conditions described above, I would expect that there's a way to tell dayjs to keep the date exactly as is but just modify the timezone offset.

Information

  • Day.js Version: 1.11.10
  • OS: MacOS Sonoma
  • Browser: Chrome Version 122.0.6261.129
  • Time zone: EST (UTC-5)

giavinh79 avatar Mar 19 '24 21:03 giavinh79

I have the same issue. Does anyone have any solution for this?

frvnkhl avatar Apr 22 '24 13:04 frvnkhl