Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timezone conversion is broken when not using DST Time #1635

Open
matthieutirelli-pro opened this issue Sep 15, 2021 · 0 comments
Open

Timezone conversion is broken when not using DST Time #1635

matthieutirelli-pro opened this issue Sep 15, 2021 · 0 comments

Comments

@matthieutirelli-pro
Copy link

Describe the bug
DST not working in dayjs

Expected behavior
It seems that DST has some problem converting times with dayjs :

dayjs("2021-10-30").set("hour", 18).set("minute", 42).tz("Europe/Paris").toISOString()
'2021-10-30T16:42:00.000Z'

It's correct, the 30th of october 2021, we are now on daylight saving time ( DST ) at Paris timezone ( UTC+1 ) we substract 2 hours to get the UTC TIME, 16:42 is correct.

dayjs("2021-10-31").set("hour", 18).set("minute", 42).tz("Europe/Paris").toISOString()
'2021-10-31T18:42:00.000Z'

Is incorrect, the 31th of october 2021, DST will be over, but we should still substract 1 hour to get the UTC Time ( 17:42 )

Seems that no matter which timezone we use, when we are not in DST, the offset is not done in reference with UTC.

dayjs("2021-10-31").set("hour", 18).set("minute", 42).tz("Asia/Tel_Aviv").toISOString()
'2021-10-31T18:42:00.000Z'


dayjs("2021-10-30").set("hour", 18).set("minute", 42).tz("Asia/Tel_Aviv").toISOString()
'2021-10-30T16:42:00.000Z'

Seems to be kind of the same problem referenced here : #1622

Information

  • Day.js Version 1.10.7
  • OS: MacOS
  • Browser : Chrome 93.0.4577.63 (Build officiel) (x86_64)
  • Time zone: UTC+1 ( Europe/Paris )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant