summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/PlainTime/prototype/until/argument-string-time-zone-annotation.js
blob: 7f01564d22edc4419c7c42e5aaf7779530d3441d (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.plaintime.prototype.until
description: Various forms of time zone annotation; critical flag has no effect
features: [Temporal]
includes: [temporalHelpers.js]
---*/

const tests = [
  ["12:34:56.987654321[Asia/Kolkata]", "named, with no offset"],
  ["12:34:56.987654321[!Europe/Vienna]", "named, with ! and no offset"],
  ["12:34:56.987654321[+00:00]", "numeric, with no offset"],
  ["12:34:56.987654321[!-02:30]", "numeric, with ! and no offset"],
  ["T12:34:56.987654321[UTC]", "named, with T and no offset"],
  ["T12:34:56.987654321[!Africa/Abidjan]", "named, with T, !, and no offset"],
  ["T12:34:56.987654321[+01:00]", "numeric, with T and no offset"],
  ["T12:34:56.987654321[!-08:00]", "numeric, with T, !, and no offset"],
  ["12:34:56.987654321+00:00[America/Sao_Paulo]", "named, with offset"],
  ["12:34:56.987654321+00:00[!Asia/Tokyo]", "named, with ! and offset"],
  ["12:34:56.987654321+00:00[-02:30]", "numeric, with offset"],
  ["12:34:56.987654321+00:00[!+00:00]", "numeric, with ! and offset"],
  ["T12:34:56.987654321+00:00[America/New_York]", "named, with T and offset"],
  ["T12:34:56.987654321+00:00[!UTC]", "named, with T, !, and offset"],
  ["T12:34:56.987654321+00:00[-08:00]", "numeric, with T and offset"],
  ["T12:34:56.987654321+00:00[!+01:00]", "numeric, with T, !, and offset"],
  ["1970-01-01T12:34:56.987654321[Africa/Lagos]", "named, with date and no offset"],
  ["1970-01-01T12:34:56.987654321[!America/Vancouver]", "named, with date, !, and no offset"],
  ["1970-01-01T12:34:56.987654321[+00:00]", "numeric, with date and no offset"],
  ["1970-01-01T12:34:56.987654321[!-02:30]", "numeric, with date, !, and no offset"],
  ["1970-01-01T12:34:56.987654321+00:00[Europe/London]", "named, with date and offset"],
  ["1970-01-01T12:34:56.987654321+00:00[!Asia/Seoul]", "named, with date, offset, and !"],
  ["1970-01-01T12:34:56.987654321+00:00[+01:00]", "numeric, with date and offset"],
  ["1970-01-01T12:34:56.987654321+00:00[!-08:00]", "numeric, with date, offset, and !"],
];

const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);

tests.forEach(([arg, description]) => {
  const result = instance.until(arg);

  TemporalHelpers.assertDuration(
    result,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    `time zone annotation (${description})`
  );
});

reportCompare(0, 0);