bhylu.com

Advertisements

Temporal Migrate

Migrate one boundary at a time. An existing Date timestamp can become a Temporal Instant without pretending it was a date-only value.

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 oldValue = new Date("2026-11-07T10:00:00Z");
  const instant = Temporal.Instant.fromEpochMilliseconds(oldValue.getTime());
  console.log(instant.toString());
}

What happens

The exact instant is preserved.