0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-05 10:26:44 -05:00
deno/tests/specs/run/unstable_temporal_api_patch/main.ts
printfn 70d775c57d
fix(unstable/temporal): implement Temporal.ZonedDateTime.getTimeZoneTransition (#27770)
This patches Temporal to support the `getTimeZoneTransition` method on
`ZonedDateTime`.

See https://github.com/denoland/deno/issues/27731.

Co-authored-by: printfn <printfn@users.noreply.github.com>
2025-02-17 14:02:34 +00:00

19 lines
619 B
TypeScript

console.log(Temporal.Now.timeZoneId());
// @ts-expect-error: undefined check
console.log(Temporal.Now.timeZone);
const zoned = new Temporal.ZonedDateTime(0n, "UTC");
console.log(zoned.calendarId);
console.log(zoned.timeZoneId);
// @ts-expect-error: undefined check
console.log(zoned.calendar);
// @ts-expect-error: undefined check
console.log(zoned.timeZone);
const duration = Temporal.Duration.from("P1DT6H30M");
console.log(duration.toLocaleString("en-US"));
const transition = Temporal.ZonedDateTime.from(
"2020-01-01T00:00:00-05:00[America/New_York]",
).getTimeZoneTransition("next");
console.log(transition);