Skip to content

Instantly share code, notes, and snippets.

@milksense
Last active June 12, 2022 01:08
Show Gist options
  • Save milksense/c5706efc1f830711e98ef3849eefbbb4 to your computer and use it in GitHub Desktop.
Save milksense/c5706efc1f830711e98ef3849eefbbb4 to your computer and use it in GitHub Desktop.
Improved Time Zone resolver
/**
* Improved Time Zone resolver
*
* @see {@link https://402.ecma-international.org/1.0/#sec-12.1} reference
* @see {@link https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat} reference
* @see {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones} reference
*
* @return {String|NULL}
*/
console.log(Intl.DateTimeFormat().resolvedOptions().timeZone)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment