Temporal

Updated · 7 min read
mediumES2026javascripttemporaldatestime-zones

Temporal is a new built-in API for dates and times, designed to replace Date. Where Date has one confusing type that is always a moment in UTC shown in local time, Temporal has separate types for separate ideas: a calendar date with no time ("January 5"), a wall-clock time ("9:00 AM"), an exact moment, and a moment in a specific time zone. Its values are immutable, months start at 1, parsing is strict, and arithmetic like "add one month" works the way people expect. Temporal reached stage 4 (finished) in TC39 in March 2026 and is expected in the 2027 edition of ECMAScript; several engines already ship it.

In One Minute

  • Temporal lives in the global Temporal object, like Math or Intl.
  • Pick a type by what you mean: PlainDate for a due date, PlainTime for office hours, ZonedDateTime for a meeting in Dallas, Instant for a timestamp.
  • Values are immutable: date.add({ days: 30 }) returns a new date.
  • Months and days are numbered the human way: January is 1.
  • As of November 2026, Temporal runs by default in Node.js 26, Chrome 144+ and Firefox 139+, but not in Safari 27.2 (the current stable release). Use a polyfill for code that must run in Safari today.

Why Temporal Exists

Problem with DateHow Temporal fixes it
Months are 0 to 11Months are 1 to 12
Mutable: setDate changes the object, shared references change tooImmutable: every operation returns a new value
One type for everything; a "date" is secretly a moment with a time and zoneSeparate types: PlainDate, PlainTime, ZonedDateTime, Instant...
Only UTC and the computer's local zoneAny IANA time zone, explicitly
"2026-01-05" parses as UTC midnight, showing as January 4 in the USPlainDate.from("2026-01-05") is January 5, period
February 30 silently becomes March 2Invalid dates throw (or clamp, if you ask)
Adding a month or comparing dates needs hand-written mathadd, subtract, since, until, compare built in

A First Look

first.js▶ Try it
const due = Temporal.PlainDate.from("2026-01-05");
 
console.log(due.toString());
console.log(due.year, due.month, due.day);
console.log(due.dayOfWeek, due.daysInMonth, due.inLeapYear);
 
const later = due.add({ days: 30 });
console.log(later.toString());
console.log(due.toString());
Output
2026-01-05
2026 1 5
1 31 false
2026-02-04
2026-01-05

Explanation: PlainDate is just a calendar date: no time, no time zone, so there's nothing to shift it to January 4. month is 1 for January. dayOfWeek uses the ISO numbering, where Monday is 1 and Sunday is 7. add returned a new date; the original due is unchanged.

Temporal vs Date, Side by Side

The same task, "the due date is 30 days after January 5, show it as a US date", both ways:

temporal-way.js▶ Try it
const invoiced = Temporal.PlainDate.from("2026-01-05");
const due = invoiced.add({ days: 30 });
console.log(due.toLocaleString("en-US", { dateStyle: "long" }));
console.log(invoiced.toString());
Output
February 4, 2026
2026-01-05

The Temporal version has no month-numbering trap, no copy step, and no hidden time of day.

Strict Parsing

Temporal parses only well-defined formats (ISO 8601 and its extension RFC 9557), and rejects impossible values:

strict.js▶ Try it
try {
  Temporal.PlainDate.from("2026-02-30");
} catch (err) {
  console.log(err.name);
}
 
console.log(Temporal.PlainDate.from({ year: 2026, month: 2, day: 30 }, { overflow: "constrain" }).toString());
 
try {
  Temporal.PlainDate.from("01/05/2026");
} catch (err) {
  console.log(err.name);
}
Output
RangeError
2026-02-28
RangeError

February 30 throws a RangeError instead of becoming March 2. If you want out-of-range days clamped to the end of the month, say so with overflow: "constrain". US-style strings like "01/05/2026" aren't accepted at all; parse those yourself into { year, month, day }.

Temporal.Now

Temporal.Now reads the current date and time, always as the type you ask for:

MethodReturns
Temporal.Now.instant()The exact current moment (Instant)
Temporal.Now.zonedDateTimeISO(zone?)Now, in a time zone (ZonedDateTime)
Temporal.Now.plainDateISO(zone?)Today's date in a zone (PlainDate)
Temporal.Now.plainTimeISO(zone?)The current wall-clock time (PlainTime)
Temporal.Now.timeZoneId()The system time zone, such as "America/Chicago"
now.js▶ Try it
const today = Temporal.Now.plainDateISO("America/Chicago");
const now = Temporal.Now.zonedDateTimeISO("America/Los_Angeles");
 
console.log(today instanceof Temporal.PlainDate);
console.log(now.timeZoneId);
console.log(typeof Temporal.Now.instant().epochMilliseconds);
Output
true
America/Los_Angeles
number

The example prints only things that don't change from run to run; the actual date and time depend on when you press Try it. Passing the zone ("America/Chicago") makes "today" explicit: at 11 PM in San Francisco it is already 1 AM the next day in Dallas, so the two cities have different answers to "what is today's date?". Without a zone, the question has no single answer.

Support and the Polyfill

As of November 2026 (from running the examples and from MDN compatibility data updated November 11, 2026):

RuntimeTemporal
Node.js 26On by default (all examples in this chapter run there)
Chrome and Edge 144+On by default
Firefox 139+On by default
Deno 2.7, Bun 1.4On by default
Safari 27.2 (current stable)Not available
Safari 27.3 (beta)Coming

Until Safari 27.3 ships, web pages that must work in Safari load a polyfill, a library that adds Temporal where it's missing (the proposal's authors maintain @js-temporal/polyfill, and temporal-polyfill is a smaller alternative). Check for native support first:

detect.js▶ Try it
console.log(typeof globalThis.Temporal === "object" ? "Native Temporal" : "Load a polyfill");
Output
Native Temporal

Node.js scripts and servers on Node.js 26 can use Temporal today without anything extra.

In Practice

The Fee Tracker's invoice uses Temporal for the date logic: a 30-day due date, a check against today's date in the school's time zone (fixed here so the example always prints the same), and US formatting:

invoice.js▶ Try it
const SCHOOL_ZONE = "America/Chicago";
 
function invoiceStatus(invoicedOn, today) {
  const due = Temporal.PlainDate.from(invoicedOn).add({ days: 30 });
  const cmp = Temporal.PlainDate.compare(today, due);
  const dueText = due.toLocaleString("en-US", { dateStyle: "medium" });
  if (cmp > 0) return `Overdue since ${dueText}`;
  if (cmp === 0) return `Due today (${dueText})`;
  return `Due ${dueText}`;
}
 
const today = Temporal.PlainDate.from("2026-02-04");   // in real code: Temporal.Now.plainDateISO(SCHOOL_ZONE)
console.log(invoiceStatus("2026-01-05", today));
console.log(invoiceStatus("2025-12-01", today));
console.log(invoiceStatus("2026-01-20", today));
Output
Due today (Feb 4, 2026)
Overdue since Dec 31, 2025
Due Feb 19, 2026

Common Mistakes

Logging a Temporal object in a console that shows {}. Call .toString().

Using Temporal in Safari without a polyfill. As of November 2026, stable Safari doesn't have it.

Using the wrong type. A birthday or due date is a PlainDate, not a ZonedDateTime. The next lesson explains how to choose.

Expecting new Temporal.PlainDate("2026-01-05"). The constructor takes numbers (new Temporal.PlainDate(2026, 1, 5)); use Temporal.PlainDate.from(string) for strings.

Practice

Challenge: Using Temporal.PlainDate, find the date 90 days after August 15, 2026 and print it as a long US date, plus its day of the week (1 = Monday).

Show solution
ninety-days.js▶ Try it
const start = Temporal.PlainDate.from("2026-08-15");
const end = start.add({ days: 90 });
console.log(end.toLocaleString("en-US", { dateStyle: "long" }), end.dayOfWeek);
Output
November 13, 2026 5

Quick check: Temporal

3 questions
1What month number does Temporal use for January?
2What does date.add({ days: 30 }) do to date?
3What happens with Temporal.PlainDate.from("2026-02-30")?

Key Takeaways

TaskCode
A calendar dateTemporal.PlainDate.from("2026-01-05")
30 days laterdate.add({ days: 30 })
Today in a zoneTemporal.Now.plainDateISO("America/Chicago")
Show to peopledate.toLocaleString("en-US", { dateStyle: "long" })
Feature checktypeof Temporal === "object"

Was this tutorial helpful?

Lesson 57 of 139