1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:37:36 +00:00

LibJS: Support non-UTC time zones in Temporal :^)

We can now recognize & normalize all time zones from the IANA time zone
database and not just 'UTC', which makes the LibJS Temporal
implementation a lot more useful! Thanks to the newly added LibTimeZone,
this was incredibly easy to implement :^)

This already includes these recent editorial changes in the Temporal
spec: 27bffe1
This commit is contained in:
Linus Groh 2022-01-11 20:20:16 +01:00
parent 205d63c3f0
commit d527eb62da
5 changed files with 49 additions and 27 deletions

View file

@ -10,6 +10,14 @@ describe("normal behavior", () => {
expect(Temporal.TimeZone.from(timeZone)).toBe(timeZone);
expect(Temporal.TimeZone.from(timeZoneLike)).toBe(timeZoneLike);
expect(Temporal.TimeZone.from(zonedDateTimeLike)).toBe(zonedDateTimeLike.timeZone);
// TODO: test from("string") once ParseTemporalTimeZoneString is working
expect(Temporal.TimeZone.from("UTC").id).toBe("UTC");
expect(Temporal.TimeZone.from("GMT").id).toBe("UTC");
expect(Temporal.TimeZone.from("Etc/UTC").id).toBe("UTC");
expect(Temporal.TimeZone.from("Etc/GMT").id).toBe("UTC");
// FIXME: https://github.com/tc39/proposal-temporal/issues/1993
// expect(Temporal.TimeZone.from("Etc/GMT+12").id).toBe("Etc/GMT+12");
// expect(Temporal.TimeZone.from("Etc/GMT-12").id).toBe("Etc/GMT-12");
expect(Temporal.TimeZone.from("Europe/London").id).toBe("Europe/London");
expect(Temporal.TimeZone.from("Europe/Isle_of_Man").id).toBe("Europe/London");
});
});