Created
March 14, 2022 08:33
-
-
Save sunpietro/8f289aca5e1378018ca77f7d9b4bc85e to your computer and use it in GitHub Desktop.
Detecting time zone offset change in DST
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const calculateDSTDiff = (timezone) => { | |
const januaryOffset = moment.tz({ month: 0, day: 1 }, timezone).utcOffset(); | |
const juneOffset = moment.tz({ month: 5, day: 1 }, timezone).utcOffset(); | |
return Math.abs(juneOffset - januaryOffset); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment