Bug 1904139 - Don't re-initialize platform font list from GetDefaultFont. r=jfkthame
[gecko.git] / js / src / tests / test262 / built-ins / Temporal / ZonedDateTime / prototype / equals / argument-propertybag-timezone-string-datetime.js
blobbdf04fbafea912b6a63f1be0104c454d044dcce5
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
2 // Copyright (C) 2021 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
5 /*---
6 esid: sec-temporal.zoneddatetime.prototype.equals
7 description: Conversion of ISO date-time strings to Temporal.TimeZone instances
8 features: [Temporal]
9 ---*/
11 let expectedTimeZone = "UTC";
12 const instance1 = new Temporal.ZonedDateTime(0n, expectedTimeZone);
14 let timeZone = "2021-02-19T17:30";
15 assert.throws(RangeError, () => instance1.equals({ year: 1970, month: 1, day: 1, timeZone }), "bare date-time string is not a time zone");
17 // The following are all valid strings so should not throw. They should produce
18 // expectedTimeZone, so additionally the operation should return true, because
19 // the property bag will produce an instance that's equal to the receiver.
21 timeZone = "2021-02-19T17:30Z";
22 assert(instance1.equals({ year: 1970, month: 1, day: 1, timeZone }), "date-time + Z is UTC time zone");
24 expectedTimeZone = "-08:00";
25 const instance2 = new Temporal.ZonedDateTime(0n, expectedTimeZone);
26 timeZone = "2021-02-19T17:30-08:00";
27 assert(instance2.equals({ year: 1969, month: 12, day: 31, hour: 16, timeZone }), "date-time + offset is the offset time zone");
29 const instance3 = new Temporal.ZonedDateTime(0n, expectedTimeZone);
30 timeZone = "2021-02-19T17:30[-08:00]";
31 assert(instance3.equals({ year: 1969, month: 12, day: 31, hour: 16, timeZone }), "date-time + IANA annotation is the IANA time zone");
33 timeZone = "2021-02-19T17:30Z[-08:00]";
34 assert(instance3.equals({ year: 1969, month: 12, day: 31, hour: 16, timeZone }), "date-time + Z + IANA annotation is the IANA time zone");
36 timeZone = "2021-02-19T17:30-08:00[-08:00]";
37 assert(instance3.equals({ year: 1969, month: 12, day: 31, hour: 16, timeZone }), "date-time + offset + IANA annotation is the IANA time zone");
39 reportCompare(0, 0);