Skip to content

Instantly share code, notes, and snippets.

@martinratinaud
Last active April 22, 2021 06:43
Show Gist options
  • Save martinratinaud/77b6093e5b248cc0f621ffce38c1fcf6 to your computer and use it in GitHub Desktop.
Save martinratinaud/77b6093e5b248cc0f621ffce38c1fcf6 to your computer and use it in GitHub Desktop.
Get current user timezone and timezone delay
const timezone: string = Intl.DateTimeFormat().resolvedOptions().timeZone; // Gives "Indian/Mauritius"
const timezoneDelayInMinutes: number = new Date().getTimezoneOffset(); // -240 because of GMT+4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment