mirror of
https://github.com/tc39/test262.git
synced 2025-07-23 14:04:51 +02:00
Temporal: Avoid recalculating offset ns after GetPlainDateTimeFor
This commit is contained in:
parent
0c87a86b58
commit
c372de0bbe
@ -24,8 +24,6 @@ const expected = [
|
|||||||
"has options.timeZone.id",
|
"has options.timeZone.id",
|
||||||
"get options.timeZone.getOffsetNanosecondsFor",
|
"get options.timeZone.getOffsetNanosecondsFor",
|
||||||
"call options.timeZone.getOffsetNanosecondsFor",
|
"call options.timeZone.getOffsetNanosecondsFor",
|
||||||
"get options.timeZone.getOffsetNanosecondsFor",
|
|
||||||
"call options.timeZone.getOffsetNanosecondsFor",
|
|
||||||
];
|
];
|
||||||
const actual = [];
|
const actual = [];
|
||||||
|
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
|
|
||||||
/*---
|
/*---
|
||||||
esid: sec-temporal.instant.prototype.tostring
|
esid: sec-temporal.instant.prototype.tostring
|
||||||
description: Passing a TimeZone to options calls getOffsetNanosecondsFor twice, but not toString
|
description: >
|
||||||
|
Passing a TimeZone to options calls getOffsetNanosecondsFor, but not toString
|
||||||
includes: [compareArray.js, temporalHelpers.js]
|
includes: [compareArray.js, temporalHelpers.js]
|
||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
@ -15,8 +16,6 @@ const expected = [
|
|||||||
"has timeZone.id",
|
"has timeZone.id",
|
||||||
"get timeZone.getOffsetNanosecondsFor",
|
"get timeZone.getOffsetNanosecondsFor",
|
||||||
"call timeZone.getOffsetNanosecondsFor",
|
"call timeZone.getOffsetNanosecondsFor",
|
||||||
"get timeZone.getOffsetNanosecondsFor",
|
|
||||||
"call timeZone.getOffsetNanosecondsFor",
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const instant = Temporal.Instant.from("1975-02-02T14:25:36.123456Z");
|
const instant = Temporal.Instant.from("1975-02-02T14:25:36.123456Z");
|
||||||
|
@ -13,8 +13,6 @@ features: [Temporal]
|
|||||||
const expected = [
|
const expected = [
|
||||||
"get this.timeZone.getOffsetNanosecondsFor",
|
"get this.timeZone.getOffsetNanosecondsFor",
|
||||||
"call this.timeZone.getOffsetNanosecondsFor",
|
"call this.timeZone.getOffsetNanosecondsFor",
|
||||||
"get this.timeZone.getOffsetNanosecondsFor",
|
|
||||||
"call this.timeZone.getOffsetNanosecondsFor",
|
|
||||||
];
|
];
|
||||||
const actual = [];
|
const actual = [];
|
||||||
|
|
||||||
|
@ -31,9 +31,6 @@ const expected = [
|
|||||||
"call this.calendar.dateAdd",
|
"call this.calendar.dateAdd",
|
||||||
"get this.timeZone.getPossibleInstantsFor",
|
"get this.timeZone.getPossibleInstantsFor",
|
||||||
"call this.timeZone.getPossibleInstantsFor",
|
"call this.timeZone.getPossibleInstantsFor",
|
||||||
// GetOffsetNanosecondsFor
|
|
||||||
"get this.timeZone.getOffsetNanosecondsFor",
|
|
||||||
"call this.timeZone.getOffsetNanosecondsFor",
|
|
||||||
// InterpretISODateTimeOffset
|
// InterpretISODateTimeOffset
|
||||||
"get this.timeZone.getPossibleInstantsFor",
|
"get this.timeZone.getPossibleInstantsFor",
|
||||||
"call this.timeZone.getPossibleInstantsFor",
|
"call this.timeZone.getPossibleInstantsFor",
|
||||||
|
26
test/built-ins/Temporal/ZonedDateTime/prototype/toJSON/order-of-operations.js
vendored
Normal file
26
test/built-ins/Temporal/ZonedDateTime/prototype/toJSON/order-of-operations.js
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Copyright (C) 2023 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.zoneddatetime.prototype.tojson
|
||||||
|
description: Properties on objects passed to toJSON() are accessed in the correct order
|
||||||
|
includes: [compareArray.js, temporalHelpers.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const expected = [
|
||||||
|
"get this.timeZone.getOffsetNanosecondsFor",
|
||||||
|
"call this.timeZone.getOffsetNanosecondsFor",
|
||||||
|
"get this.timeZone.id",
|
||||||
|
"get this.calendar.id",
|
||||||
|
];
|
||||||
|
const actual = [];
|
||||||
|
|
||||||
|
const timeZone = TemporalHelpers.timeZoneObserver(actual, "this.timeZone");
|
||||||
|
const calendar = TemporalHelpers.calendarObserver(actual, "this.calendar");
|
||||||
|
const instance = new Temporal.ZonedDateTime(0n, timeZone, calendar);
|
||||||
|
// clear observable operations that occurred during the constructor call
|
||||||
|
actual.splice(0);
|
||||||
|
|
||||||
|
instance.toJSON();
|
||||||
|
assert.compareArray(actual, expected, "order of operations");
|
@ -29,8 +29,6 @@ const expected = [
|
|||||||
"call options.timeZoneName.toString",
|
"call options.timeZoneName.toString",
|
||||||
"get this.timeZone.getOffsetNanosecondsFor",
|
"get this.timeZone.getOffsetNanosecondsFor",
|
||||||
"call this.timeZone.getOffsetNanosecondsFor",
|
"call this.timeZone.getOffsetNanosecondsFor",
|
||||||
"get this.timeZone.getOffsetNanosecondsFor",
|
|
||||||
"call this.timeZone.getOffsetNanosecondsFor",
|
|
||||||
"get this.timeZone.id",
|
"get this.timeZone.id",
|
||||||
"get this.calendar.id",
|
"get this.calendar.id",
|
||||||
];
|
];
|
||||||
@ -75,8 +73,6 @@ const expectedForFractionalSecondDigits = [
|
|||||||
"call options.timeZoneName.toString",
|
"call options.timeZoneName.toString",
|
||||||
"get this.timeZone.getOffsetNanosecondsFor",
|
"get this.timeZone.getOffsetNanosecondsFor",
|
||||||
"call this.timeZone.getOffsetNanosecondsFor",
|
"call this.timeZone.getOffsetNanosecondsFor",
|
||||||
"get this.timeZone.getOffsetNanosecondsFor",
|
|
||||||
"call this.timeZone.getOffsetNanosecondsFor",
|
|
||||||
"get this.timeZone.id",
|
"get this.timeZone.id",
|
||||||
"get this.calendar.id",
|
"get this.calendar.id",
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user