bhylu.com

Advertisements

Temporal Conversion

Conversion can discard information. Extract a PlainDate when only the calendar date is needed, and keep the original zoned value if later code needs the instant.

Where to run this

This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.

A practical example

JavaScript

if (typeof Temporal === "undefined") {
  console.log("Temporal is not available in this runtime. Use a supporting browser or a reviewed local polyfill.");
} else {
  const meeting = Temporal.ZonedDateTime.from("2026-11-07T10:30[Europe/London]");
  console.log(meeting.toPlainDate().toString());
}

What happens

The extracted calendar date is 2026-11-07.