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 2 commits into from Jun 21, 2018


Copy link

@leshakoss leshakoss 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 requested a review from kossnocorp Jun 21, 2018
Copy link

@kossnocorp kossnocorp left a comment


@leshakoss leshakoss merged commit 7353d74 into master Jun 21, 2018
1 check was pending
@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
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants