mirror of https://github.com/tc39/test262.git
Test conversion of Temporal.Instant strings with sub-minute UTC offsets
This commit is contained in:
parent
9cd27beb12
commit
d28ca991cb
|
@ -0,0 +1,17 @@
|
|||
// 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.instant.compare
|
||||
description: Temporal.Instant string with sub-minute offset
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const epoch = new Temporal.Instant(0n);
|
||||
const str = "1970-01-01T00:19:32.37+00:19:32.37";
|
||||
|
||||
const result1 = Temporal.Instant.compare(str, epoch);
|
||||
assert.sameValue(result1, 0, "if present, sub-minute offset is accepted exactly (first argument)");
|
||||
|
||||
const result2 = Temporal.Instant.compare(epoch, str);
|
||||
assert.sameValue(result2, 0, "if present, sub-minute offset is accepted exactly (second argument)");
|
|
@ -0,0 +1,12 @@
|
|||
// 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.instant.from
|
||||
description: Temporal.Instant string with sub-minute offset
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const str = "1970-01-01T00:19:32.37+00:19:32.37";
|
||||
const result = Temporal.Instant.from(str);
|
||||
assert.sameValue(result.epochNanoseconds, 0n, "if present, sub-minute offset is accepted exactly");
|
14
test/built-ins/Temporal/Instant/prototype/equals/instant-string-sub-minute-offset.js
vendored
Normal file
14
test/built-ins/Temporal/Instant/prototype/equals/instant-string-sub-minute-offset.js
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
// 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.instant.prototype.equals
|
||||
description: Temporal.Instant string with sub-minute offset
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Instant(0n);
|
||||
|
||||
const str = "1970-01-01T00:19:32.37+00:19:32.37";
|
||||
const result = instance.equals(str);
|
||||
assert.sameValue(result, true, "if present, sub-minute offset is accepted exactly");
|
15
test/built-ins/Temporal/Instant/prototype/since/instant-string-sub-minute-offset.js
vendored
Normal file
15
test/built-ins/Temporal/Instant/prototype/since/instant-string-sub-minute-offset.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// 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.instant.prototype.since
|
||||
description: Temporal.Instant string with sub-minute offset
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Instant(0n);
|
||||
|
||||
const str = "1970-01-01T00:19:32.37+00:19:32.37";
|
||||
const result = instance.since(str);
|
||||
TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "if present, sub-minute offset is accepted exactly");
|
15
test/built-ins/Temporal/Instant/prototype/until/instant-string-sub-minute-offset.js
vendored
Normal file
15
test/built-ins/Temporal/Instant/prototype/until/instant-string-sub-minute-offset.js
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// 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.instant.prototype.until
|
||||
description: Temporal.Instant string with sub-minute offset
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Instant(0n);
|
||||
|
||||
const str = "1970-01-01T00:19:32.37+00:19:32.37";
|
||||
const result = instance.until(str);
|
||||
TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "if present, sub-minute offset is accepted exactly");
|
|
@ -0,0 +1,15 @@
|
|||
// 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.timezone.prototype.getplaindatetimefor
|
||||
description: Temporal.Instant string with sub-minute offset
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.TimeZone("UTC");
|
||||
|
||||
const str = "1970-01-01T00:19:32.37+00:19:32.37";
|
||||
const result = instance.getPlainDateTimeFor(str);
|
||||
TemporalHelpers.assertPlainDateTime(result, 1970, 1, "M01", 1, 0, 0, 0, 0, 0, 0, "if present, sub-minute offset is accepted exactly");
|
Loading…
Reference in New Issue