summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/TimeZone/prototype/getInstantFor/options-undefined.js
blob: 6ddd03d9ef1cff4e374a43f8a933e346077a4a27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.timezone.prototype.getinstantfor
includes: [temporalHelpers.js]
description: Verify that undefined options are handled correctly.
features: [BigInt, Temporal]
---*/

const datetimeEarlier = new Temporal.PlainDateTime(2000, 10, 29, 1, 34, 56, 987, 654, 321);
const datetimeLater = new Temporal.PlainDateTime(2000, 4, 2, 2, 34, 56, 987, 654, 321);
const timeZone = TemporalHelpers.springForwardFallBackTimeZone();

[
  [datetimeEarlier, 972808496987654321n],
  [datetimeLater, 954671696987654321n],
].forEach(([datetime, expected]) => {
  const explicit = timeZone.getInstantFor(datetime, undefined);
  assert.sameValue(explicit.epochNanoseconds, expected, "default disambiguation is compatible");

  const implicit = timeZone.getInstantFor(datetime);
  assert.sameValue(implicit.epochNanoseconds, expected, "default disambiguation is compatible");
});

reportCompare(0, 0);