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

tz(timezone, true).utc() is not always changing the time to UTC #1641

Open
hbj opened this issue Sep 22, 2021 · 0 comments
Open

tz(timezone, true).utc() is not always changing the time to UTC #1641

hbj opened this issue Sep 22, 2021 · 0 comments

Comments

@hbj
Copy link

hbj commented Sep 22, 2021

Describe the bug
Calling utc() without passing true as parameter should change the current time to UTC. However this doesn't always work on a dayjs object returned by tz() where the second parameter is set to true (to keep current time).

Example (Europe/Paris is GMT+1 / GMT+2 in DST):

dayjs('2021-02-01T15:00').tz('Europe/Paris', true).utc().format()
dayjs('2021-09-01T15:00').tz('Europe/Paris', true).utc().format()

returns

'2021-02-01T15:00:00Z'  => NON DST: INCORRECT
'2021-09-01T13:00:00Z'  => DST: CORRECT

Expected behavior
For non DST it should return

'2021-02-01T14:00:00Z'

Information

  • Day.js Version [1.10.7]
  • OS: [MacOS 11.5.2]
  • Browser [Chrome 93]
  • Time zone: [GMT+02:00 DST (Europe/Paris)]
@hbj hbj changed the title tz(timezone, true).utc() is not channging the time to UTC tz(timezone, true).utc() is not changing the time to UTC Sep 22, 2021
@hbj hbj changed the title tz(timezone, true).utc() is not changing the time to UTC tz(timezone, true).utc() is not always changing the time to UTC Sep 22, 2021
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