toString-localized-posix.js (2730B)
1 // |reftest| skip-if(!this.hasOwnProperty("Intl")) -- Requires ICU time zone support 2 3 // Date.prototype.toString includes a localized time zone name comment. 4 5 // Repeats the test from "toString-localized.js", but uses POSIX instead of IANA 6 // names for the time zones. This allows to run these tests on Windows, too. 7 8 inTimeZone("PST8PDT", () => { 9 let dt = new Date(2018, Month.July, 14); 10 11 withLocale("en", () => { 12 assertDateTime(dt, "Sat Jul 14 2018 00:00:00 GMT-0700 (Pacific Daylight Time)"); 13 }); 14 withLocale("fr", () => { 15 assertDateTime(dt, "Sat Jul 14 2018 00:00:00 GMT-0700 (heure d’été du Pacifique nord-américain)"); 16 }); 17 withLocale("de", () => { 18 assertDateTime(dt, "Sat Jul 14 2018 00:00:00 GMT-0700 (Nordamerikanische Westküsten-Sommerzeit)"); 19 }); 20 withLocale("ar", () => { 21 assertDateTime(dt, "Sat Jul 14 2018 00:00:00 GMT-0700 (توقيت المحيط الهادي الصيفي)"); 22 }); 23 withLocale("zh", () => { 24 assertDateTime(dt, "Sat Jul 14 2018 00:00:00 GMT-0700 (北美太平洋夏令时间)"); 25 }); 26 }); 27 28 for (let tz of ["UTC", "UCT"]) { 29 inTimeZone(tz, () => { 30 let dt = new Date(2018, Month.July, 14); 31 32 withLocale("en", () => { 33 assertDateTime(dt, "Sat Jul 14 2018 00:00:00 GMT+0000 (Coordinated Universal Time)"); 34 }); 35 withLocale("fr", () => { 36 assertDateTime(dt, "Sat Jul 14 2018 00:00:00 GMT+0000 (temps universel coordonné)"); 37 }); 38 withLocale("de", () => { 39 assertDateTime(dt, "Sat Jul 14 2018 00:00:00 GMT+0000 (Koordinierte Weltzeit)"); 40 }); 41 withLocale("ar", () => { 42 assertDateTime(dt, "Sat Jul 14 2018 00:00:00 GMT+0000 (التوقيت العالمي المنسق)"); 43 }); 44 withLocale("zh", () => { 45 assertDateTime(dt, "Sat Jul 14 2018 00:00:00 GMT+0000 (协调世界时)"); 46 }); 47 }); 48 } 49 50 inTimeZone("GMT", () => { 51 let dt = new Date(2018, Month.July, 14); 52 53 withLocale("en", () => { 54 assertDateTime(dt, "Sat Jul 14 2018 00:00:00 GMT+0000 (Greenwich Mean Time)"); 55 }); 56 withLocale("fr", () => { 57 assertDateTime(dt, "Sat Jul 14 2018 00:00:00 GMT+0000 (heure moyenne de Greenwich)"); 58 }); 59 withLocale("de", () => { 60 assertDateTime(dt, "Sat Jul 14 2018 00:00:00 GMT+0000 (Mittlere Greenwich-Zeit)"); 61 }); 62 withLocale("ar", () => { 63 assertDateTime(dt, "Sat Jul 14 2018 00:00:00 GMT+0000 (توقيت غرينتش)"); 64 }); 65 withLocale("zh", () => { 66 assertDateTime(dt, "Sat Jul 14 2018 00:00:00 GMT+0000 (格林尼治标准时间)"); 67 }); 68 }); 69 70 if (typeof reportCompare === "function") 71 reportCompare(true, true);