Skip to content

Add getTimezoneOffsetInMilliseconds utility function#789

Merged
leshakoss merged 2 commits intomasterfrom
tz-offset-with-seconds-bug
Jun 21, 2018
Merged

Add getTimezoneOffsetInMilliseconds utility function#789
leshakoss merged 2 commits intomasterfrom
tz-offset-with-seconds-bug

Conversation

@leshakoss
Copy link
Copy Markdown
Member

Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
They usually appear for dates that denote time before the timezones were introduced
(e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
and GMT+01:00:00 after that date)

Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
which would lead to incorrect calculations.

This PR introduces an utility function getTimezoneOffsetInMilliseconds which returns the timezone offset in milliseconds and takes seconds in account.

@leshakoss leshakoss added the 🐛 Bug Something's wrong label Jun 21, 2018
@leshakoss leshakoss requested a review from kossnocorp June 21, 2018 09:00
Copy link
Copy Markdown
Member

@kossnocorp kossnocorp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@leshakoss leshakoss merged commit 7353d74 into master Jun 21, 2018
@leshakoss leshakoss deleted the tz-offset-with-seconds-bug branch June 21, 2018 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 Bug Something's wrong

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants