tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

argument-string-time-zone-annotation.js (2494B)


      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.
      4 
      5 /*---
      6 esid: sec-temporal.plaintime.from
      7 description: Various forms of time zone annotation; critical flag has no effect
      8 features: [Temporal]
      9 includes: [temporalHelpers.js]
     10 ---*/
     11 
     12 const tests = [
     13  ["12:34:56.987654321[Asia/Kolkata]", "named, with no offset"],
     14  ["12:34:56.987654321[!Europe/Vienna]", "named, with ! and no offset"],
     15  ["12:34:56.987654321[+00:00]", "numeric, with no offset"],
     16  ["12:34:56.987654321[!-02:30]", "numeric, with ! and no offset"],
     17  ["T12:34:56.987654321[UTC]", "named, with T and no offset"],
     18  ["T12:34:56.987654321[!Africa/Abidjan]", "named, with T, !, and no offset"],
     19  ["T12:34:56.987654321[+01:00]", "numeric, with T and no offset"],
     20  ["T12:34:56.987654321[!-08:00]", "numeric, with T, !, and no offset"],
     21  ["12:34:56.987654321+00:00[America/Sao_Paulo]", "named, with offset"],
     22  ["12:34:56.987654321+00:00[!Asia/Tokyo]", "named, with ! and offset"],
     23  ["12:34:56.987654321+00:00[-02:30]", "numeric, with offset"],
     24  ["12:34:56.987654321+00:00[!+00:00]", "numeric, with ! and offset"],
     25  ["T12:34:56.987654321+00:00[America/New_York]", "named, with T and offset"],
     26  ["T12:34:56.987654321+00:00[!UTC]", "named, with T, !, and offset"],
     27  ["T12:34:56.987654321+00:00[-08:00]", "numeric, with T and offset"],
     28  ["T12:34:56.987654321+00:00[!+01:00]", "numeric, with T, !, and offset"],
     29  ["1970-01-01T12:34:56.987654321[Africa/Lagos]", "named, with date and no offset"],
     30  ["1970-01-01T12:34:56.987654321[!America/Vancouver]", "named, with date, !, and no offset"],
     31  ["1970-01-01T12:34:56.987654321[+00:00]", "numeric, with date and no offset"],
     32  ["1970-01-01T12:34:56.987654321[!-02:30]", "numeric, with date, !, and no offset"],
     33  ["1970-01-01T12:34:56.987654321+00:00[Europe/London]", "named, with date and offset"],
     34  ["1970-01-01T12:34:56.987654321+00:00[!Asia/Seoul]", "named, with date, offset, and !"],
     35  ["1970-01-01T12:34:56.987654321+00:00[+01:00]", "numeric, with date and offset"],
     36  ["1970-01-01T12:34:56.987654321+00:00[!-08:00]", "numeric, with date, offset, and !"],
     37 ];
     38 
     39 tests.forEach(([arg, description]) => {
     40  const result = Temporal.PlainTime.from(arg);
     41 
     42  TemporalHelpers.assertPlainTime(
     43    result,
     44    12, 34, 56, 987, 654, 321,
     45    `time zone annotation (${description})`
     46  );
     47 });
     48 
     49 reportCompare(0, 0);