mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 18:07:35 +00:00
LibJS: Remove extra property check from Instant#toZonedDateTimeISO
This is a normative change in the Temporal spec.
See: 7dfbd80
This commit is contained in:
parent
f7bb79d6d1
commit
707f12f927
2 changed files with 24 additions and 19 deletions
|
@ -25,6 +25,25 @@ describe("correct behavior", () => {
|
|||
const zonedDateTime = instant.toZonedDateTimeISO({ timeZone });
|
||||
expect(zonedDateTime.timeZone).toBe(timeZone);
|
||||
});
|
||||
|
||||
test("avoids extra timeZone property lookup", () => {
|
||||
const instant = new Temporal.Instant(1625614921123456789n);
|
||||
|
||||
let timesGetterCalled = 0;
|
||||
const timeZoneObject = {
|
||||
get timeZone() {
|
||||
timesGetterCalled++;
|
||||
return "UTC";
|
||||
},
|
||||
|
||||
toString() {
|
||||
return "UTC";
|
||||
},
|
||||
};
|
||||
|
||||
instant.toZonedDateTimeISO({ timeZone: timeZoneObject });
|
||||
expect(timesGetterCalled).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue