argument-valid.js (1037B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2020 Igalia, S.L. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-temporal.zoneddatetime.from 7 description: Built-in time zones are parsed correctly out of valid strings 8 features: [Temporal, canonical-tz] 9 ---*/ 10 11 const valids = [ 12 ["Africa/Bissau"], 13 ["America/Belem"], 14 ["Europe/Vienna"], 15 ["America/New_York"], 16 ["Africa/CAIRO", "Africa/Cairo"], 17 ["Asia/Ulan_Bator"], 18 ["GMT"], 19 ["etc/gmt", "Etc/GMT"], 20 ["1994-11-05T08:15:30-05:00[America/New_York]", "America/New_York"], 21 ["1994-11-05T08:15:30-05[America/New_York]", "America/New_York"], 22 ]; 23 24 for (const [valid, canonical = valid] of valids) { 25 const result = Temporal.ZonedDateTime.from({ year: 1970, month: 1, day: 1, timeZone: valid }); 26 assert.sameValue(Object.getPrototypeOf(result), Temporal.ZonedDateTime.prototype); 27 assert.sameValue(result.timeZoneId, canonical); 28 } 29 30 reportCompare(0, 0);