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

commented Jun 21, 2018

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 label Jun 21, 2018

@leshakoss leshakoss requested a review from kossnocorp Jun 21, 2018

@kossnocorp
Copy link
Member

left a comment

👌

@leshakoss leshakoss merged commit 7353d74 into master Jun 21, 2018

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

@leshakoss leshakoss deleted the tz-offset-with-seconds-bug branch Jun 21, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.