Bug 1906091 - Adjust MLS timeout fallback value to 5 r=emilio
[gecko.git] / js / src / tests / test262 / built-ins / Temporal / ZonedDateTime / prototype / equals / argument-string-date-with-utc-offset.js
blob3a4a83d679ab2445c3036f3345ffc3cda2a128bf
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.
5 /*---
6 esid: sec-temporal.zoneddatetime.prototype.equals
7 description: UTC offset not valid with format that does not include a time
8 features: [Temporal]
9 ---*/
11 const timeZone = new Temporal.TimeZone("UTC");
12 const instance = new Temporal.ZonedDateTime(0n, timeZone);
14 const validStrings = [
15   "1970-01-01T00Z[UTC]",
16   "1970-01-01T00Z[!UTC]",
17   "1970-01-01T00+00:00[UTC]",
18   "1970-01-01T00+00:00[!UTC]",
21 for (const arg of validStrings) {
22   const result = instance.equals(arg);
24   assert.sameValue(
25     result,
26     true,
27     `"${arg}" is a valid UTC offset with time for ZonedDateTime`
28   );
31 const invalidStrings = [
32   "2022-09-15Z[UTC]",
33   "2022-09-15Z[Europe/Vienna]",
34   "2022-09-15+00:00[UTC]",
35   "2022-09-15-02:30[America/St_Johns]",
38 for (const arg of invalidStrings) {
39   assert.throws(
40     RangeError,
41     () => instance.equals(arg),
42     `"${arg}" UTC offset without time is not valid for ZonedDateTime`
43   );
46 reportCompare(0, 0);