Skip to content

Commit

Permalink
Repeat Instant.p.toString() test with timeZone parameter for IANA tim…
Browse files Browse the repository at this point in the history
…e zones

This adds to the intl402/ tree a copy of
built-ins/Temporal/Instant/prototype/toString/timezone-offset.js but which
uses IANA time zones.
  • Loading branch information
ptomato authored and Ms2ger committed Apr 13, 2022
1 parent 9b2c98c commit 9f30311
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// 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.instant.prototype.tostring
description: The time zone offset part of the string serialization (Intl time zones)
features: [BigInt, Temporal]
---*/

const instant = new Temporal.Instant(0n);

function test(timeZoneIdentifier, expected, description) {
const timeZone = new Temporal.TimeZone(timeZoneIdentifier);
assert.sameValue(instant.toString({ timeZone }), expected, description);
}

test("Europe/Berlin", "1970-01-01T01:00:00+01:00", "positive offset");
test("America/New_York", "1969-12-31T19:00:00-05:00", "negative offset");
test("Africa/Monrovia", "1969-12-31T23:15:30-00:45", "sub-minute offset");

0 comments on commit 9f30311

Please sign in to comment.