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

Add getTimezoneOffsetInMilliseconds utility function #789

Merged
merged 2 commits into from Jun 21, 2018

Conversation

leshakoss
Copy link
Contributor

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.

Copy link
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants