Last active
April 13, 2024 20:06
-
-
Save liam-jones-lucout/1c8b19ad6fcaf4103bb4b6af97877cd7 to your computer and use it in GitHub Desktop.
Is British Summer time BST
This file contains 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
export function isBritishSummerInEffect(date: Date) { | |
const possibleBstHour = parseInt( | |
date | |
.toLocaleTimeString("en-GB", { timeZone: "Europe/London" }) | |
.split(":")[0], | |
); | |
const utcHour = now.getUTCHours(); | |
return possibleBstHour !== utcHour; | |
} | |
export function isCurrentlyBritishSummerTime() { | |
return isBritishSummerInEffect(new Date()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment