Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/Instant/compare/instant-string-sub-minute-offset.js

raw
1 // |reftest| shell-option(--enable-temporal) skip-if(!this.hasOwnProperty('Temporal')||!xulRuntime.shell) -- Temporal is not enabled unconditionally, requires shell-options
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.instant.compare
7 description: Temporal.Instant string with sub-minute offset
8 features: [Temporal]
9 ---*/
10
11 const epoch = new Temporal.Instant(0n);
12 const str = "1970-01-01T00:19:32.37+00:19:32.37";
13
14 const result1 = Temporal.Instant.compare(str, epoch);
15 assert.sameValue(result1, 0, "if present, sub-minute offset is accepted exactly (first argument)");
16
17 const result2 = Temporal.Instant.compare(epoch, str);
18 assert.sameValue(result2, 0, "if present, sub-minute offset is accepted exactly (second argument)");
19
20 reportCompare(0, 0);