argument-propertybag-timezone-string-datetime.js (1188B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2022 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: Conversion of ISO date-time strings to time zone IDs (with IANA time zones) 8 features: [Temporal] 9 ---*/ 10 11 let timeZone = "2021-08-19T17:30[America/Vancouver]"; 12 const result1 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); 13 assert.sameValue(result1.timeZoneId, "America/Vancouver", "date-time + IANA annotation is the IANA time zone"); 14 15 timeZone = "2021-08-19T17:30Z[America/Vancouver]"; 16 const result2 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); 17 assert.sameValue(result2.timeZoneId, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone"); 18 19 timeZone = "2021-08-19T17:30-07:00[America/Vancouver]"; 20 const result3 = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone }); 21 assert.sameValue(result3.timeZoneId, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone"); 22 23 reportCompare(0, 0);