1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 16:07:45 +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:
Luke Wilde 2022-10-16 00:29:35 +01:00 committed by Linus Groh
parent f7bb79d6d1
commit 707f12f927
2 changed files with 24 additions and 19 deletions

View file

@ -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", () => {