Temporal
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
Temporalobject, likeMathorIntl. - Pick a type by what you mean:
PlainDatefor a due date,PlainTimefor office hours,ZonedDateTimefor a meeting in Dallas,Instantfor 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 Date | How Temporal fixes it |
|---|---|
| Months are 0 to 11 | Months are 1 to 12 |
Mutable: setDate changes the object, shared references change too | Immutable: every operation returns a new value |
| One type for everything; a "date" is secretly a moment with a time and zone | Separate types: PlainDate, PlainTime, ZonedDateTime, Instant... |
| Only UTC and the computer's local zone | Any IANA time zone, explicitly |
"2026-01-05" parses as UTC midnight, showing as January 4 in the US | PlainDate.from("2026-01-05") is January 5, period |
| February 30 silently becomes March 2 | Invalid dates throw (or clamp, if you ask) |
| Adding a month or comparing dates needs hand-written math | add, subtract, since, until, compare built in |
A First Look
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());2026-01-05
2026 1 5
1 31 false
2026-02-04
2026-01-05Explanation: 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:
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());const invoiced = new Date(2026, 0, 5); // month 0 = January
const due = new Date(invoiced); // copy first, or setDate changes invoiced
due.setDate(due.getDate() + 30);
console.log(due.toLocaleDateString("en-US", { dateStyle: "long" }));February 4, 2026
2026-01-05The 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:
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);
}RangeError
2026-02-28
RangeErrorFebruary 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:
| Method | Returns |
|---|---|
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" |
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);true
America/Los_Angeles
numberThe 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):
| Runtime | Temporal |
|---|---|
| Node.js 26 | On 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.4 | On 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:
console.log(typeof globalThis.Temporal === "object" ? "Native Temporal" : "Load a polyfill");Native TemporalNode.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:
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));Due today (Feb 4, 2026)
Overdue since Dec 31, 2025
Due Feb 19, 2026Common 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
const start = Temporal.PlainDate.from("2026-08-15");
const end = start.add({ days: 90 });
console.log(end.toLocaleString("en-US", { dateStyle: "long" }), end.dayOfWeek);November 13, 2026 5Key Takeaways
| Task | Code |
|---|---|
| A calendar date | Temporal.PlainDate.from("2026-01-05") |
| 30 days later | date.add({ days: 30 }) |
| Today in a zone | Temporal.Now.plainDateISO("America/Chicago") |
| Show to people | date.toLocaleString("en-US", { dateStyle: "long" }) |
| Feature check | typeof Temporal === "object" |
Was this tutorial helpful?