locale.js (683B)
1 // |jit-test| skip-if: typeof Intl === 'undefined' 2 3 function test(locale, timeZone, timeZoneName) { 4 let global = newGlobal({locale, timeZone}); 5 6 const constructors = ["Collator", "DateTimeFormat", "ListFormat", 7 "NumberFormat", "PluralRules", "RelativeTimeFormat"]; 8 for (const constructor of constructors) { 9 let intl = new global.Intl[constructor]; 10 assertEq(intl.resolvedOptions().locale, locale); 11 } 12 13 const date = new global.Date(2012, 0, 10); 14 let tzRE = /\(([^\)]+)\)/; 15 assertEq(tzRE.exec(date)[1], timeZoneName) 16 } 17 18 test("de-CH", "Atlantic/Reykjavik", "Mittlere Greenwich-Zeit"); 19 test("en", "Atlantic/Reykjavik", "Greenwich Mean Time");