Skip to content

Instantly share code, notes, and snippets.

@mathiasbynens
Created March 24, 2023 09:29
Show Gist options
  • Save mathiasbynens/cd6b77d9d4f045162d46337b31f0c73b to your computer and use it in GitHub Desktop.
Save mathiasbynens/cd6b77d9d4f045162d46337b31f0c73b to your computer and use it in GitHub Desktop.
const normalizeTimeZone = (timeZone) => {
const dtf = new Intl.DateTimeFormat('en-US', { timeZone });
const normalized = dtf.resolvedOptions().timeZone;
console.log(`${timeZone} → ${normalized}`);
return normalized;
};
// https://github.com/justingrant/proposal-canonical-tz#3-fix-out-of-date-canonicalizations-in-v8webkit
normalizeTimeZone('Africa/Asmara');
normalizeTimeZone('Africa/Asmera');
normalizeTimeZone('America/Atikokan');
normalizeTimeZone('America/Coral_Harbour');
normalizeTimeZone('America/Godthab');
normalizeTimeZone('America/Nuuk');
normalizeTimeZone('Asia/Calcutta');
normalizeTimeZone('Asia/Ho_Chi_Minh');
normalizeTimeZone('Asia/Kathmandu');
normalizeTimeZone('Asia/Katmandu');
normalizeTimeZone('Asia/Kolkata');
normalizeTimeZone('Asia/Rangoon');
normalizeTimeZone('Asia/Saigon');
normalizeTimeZone('Asia/Ulaanbaatar');
normalizeTimeZone('Asia/Ulan_Bator');
normalizeTimeZone('Asia/Yangon');
normalizeTimeZone('Atlantic/Faeroe');
normalizeTimeZone('Atlantic/Faroe');
normalizeTimeZone('Europe/Kiev');
normalizeTimeZone('Europe/Kyiv');
normalizeTimeZone('Pacific/Enderbury');
normalizeTimeZone('Pacific/Kanton');
normalizeTimeZone('Pacific/Pohnpei');
normalizeTimeZone('Pacific/Ponape');
normalizeTimeZone('Pacific/Truk');
normalizeTimeZone('Pacific/Yap');
normalizeTimeZone('Pacific/Yap');
// https://bugs.chromium.org/p/chromium/issues/detail?id=580195#c3
normalizeTimeZone('Australia/Sydney');
normalizeTimeZone('Australia/NSW');
normalizeTimeZone('Australia/Canberra');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment