If you have worked with dates in JavaScript, you have probably been caught out by Date. Months start at zero. Objects are mutable, so passing a date into a function can change it behind your back. Parsing strings behaves differently depending on the format. There is no proper time zone support beyond the user's local zone and UTC. Adding a month or working out the number of days between two dates means writing your own maths, or installing a library like date-fns, Luxon or Day.js.
Temporal is the replacement. It is a new global object, built into the language, with separate types for the different things people mean when they say "a date": a calendar date, a wall-clock time, an exact moment, or a length of time. It reached Stage 4 at TC39 in March 2026, which means it is part of the ECMAScript standard.
This article is for JavaScript developers who want to understand Temporal's main types, when to use each one, and how to adopt it today, including in browsers that do not have it yet.
The core idea: pick the right type
#Date tries to be everything at once. Under the hood it is just a count of milliseconds since 1 January 1970 UTC, and every method converts that number to your local time zone on the fly. That is why a birthday stored as a Date can show up as the day before for someone in another country.
Temporal splits this into types that each carry exactly the information they need:
| Type | What it represents | Example |
|---|---|---|
Temporal.PlainDate | A calendar date, no time or zone | A birthday, a public holiday |
Temporal.PlainTime | A wall-clock time, no date or zone | Opening time: 09:00 |
Temporal.PlainDateTime | A date and time, no zone | A local event time before you know the zone |
Temporal.ZonedDateTime | A date and time in a specific time zone | A meeting at 10:00 in London |
Temporal.Instant | An exact moment on the global timeline | A log timestamp |
Temporal.Duration | A length of time | 1 hour 30 minutes |
There are also Temporal.PlainYearMonth and Temporal.PlainMonthDay for things like "November 2026" or "25 December", and Temporal.Now for getting the current time.
Two rules apply to every type:
- They are immutable. Methods like
add()return a new object instead of changing the original. - Months are numbered from 1. January is 1, December is 12.
PlainDate: calendar dates without time zone bugs
#Use PlainDate whenever the time of day does not matter.
_10const birthday = Temporal.PlainDate.from('1990-06-15');_10_10birthday.year; // 1990_10birthday.month; // 6_10birthday.day; // 15_10birthday.dayOfWeek; // 5 (Monday is 1, Sunday is 7)_10_10const today = Temporal.Now.plainDateISO();
You can also build one from parts:
_10const launch = Temporal.PlainDate.from({ year: 2026, month: 11, day: 27 });_10launch.toString(); // '2026-11-27'
Doing arithmetic
Adding days, weeks, months or years is built in:
_10const start = Temporal.PlainDate.from('2026-01-31');_10_10start.add({ days: 1 }).toString(); // '2026-02-01'_10start.add({ months: 1 }).toString(); // '2026-02-28'_10start.subtract({ years: 1 }).toString(); // '2025-01-31'
Notice that adding one month to 31 January gives 28 February, not 3 March. By default Temporal constrains the result to the last valid day of the month. If you would rather get an error, pass { overflow: 'reject' } as a second argument.
To change one field, use with():
_10const firstOfMonth = start.with({ day: 1 }); // 2026-01-01
Working out the difference
until() and since() return a Duration:
_10const today = Temporal.PlainDate.from('2026-11-27');_10const christmas = Temporal.PlainDate.from('2026-12-25');_10_10today.until(christmas).days; // 28_10_10const age = Temporal.PlainDate.from('1990-06-15')_10 .until(today, { largestUnit: 'year' });_10_10age.years; // 36
The largestUnit option controls how the result is broken down. Without it, PlainDate differences are expressed in days.
ZonedDateTime: real-world times in real time zones
#ZonedDateTime is the type to reach for when you are dealing with something that happens at a particular time in a particular place. It knows its IANA time zone, such as Europe/London or America/New_York, and it handles daylight saving time for you.
_10const meeting = Temporal.ZonedDateTime.from(_10 '2026-11-30T10:00[Europe/London]'_10);_10_10meeting.toString();_10// '2026-11-30T10:00:00+00:00[Europe/London]'
Converting to another zone is one method call:
_10const inNewYork = meeting.withTimeZone('America/New_York');_10inNewYork.hour; // 5
To get the current time in the user's zone:
_10const now = Temporal.Now.zonedDateTimeISO();_10now.timeZoneId; // for example 'Europe/London'
Daylight saving time, handled
In the UK, clocks go forward at 01:00 on 29 March 2026. That day is only 23 hours long. Watch what happens when you add a day compared with adding 24 hours:
_10const before = Temporal.ZonedDateTime.from(_10 '2026-03-28T12:00[Europe/London]'_10);_10_10before.add({ days: 1 }).toString();_10// '2026-03-29T12:00:00+01:00[Europe/London]'_10_10before.add({ hours: 24 }).toString();_10// '2026-03-29T13:00:00+01:00[Europe/London]'
Adding a day keeps the same wall-clock time, which is what you want for "same time tomorrow". Adding 24 hours adds exactly 24 real hours. With Date, you would have to know about this and handle it yourself.
Instant: exact moments for machines
#Instant is a point on the global timeline with no time zone or calendar attached. It is the closest thing in Temporal to what Date actually stores, but with nanosecond precision.
Use it for timestamps: logs, database records, API responses, measuring when something happened.
_10const now = Temporal.Now.instant();_10now.toString(); // '2026-11-27T14:03:12.123456789Z'_10_10const created = Temporal.Instant.from('2026-11-27T09:00:00Z');_10now.since(created).toString(); // for example 'PT18192.123456789S'
When you need to show an instant to a person, convert it to a zoned value first:
_10const local = created.toZonedDateTimeISO('Europe/London');_10local.toLocaleString('en-GB', { dateStyle: 'full', timeStyle: 'short' });_10// 'Friday 27 November 2026 at 09:00'
A good rule: store and send Instant values (as ISO strings with a Z), and convert to ZonedDateTime at the edge, when displaying to a user.
Duration: lengths of time
#Duration represents an amount of time, such as "2 hours 30 minutes" or "1 year 2 months". You get one from until() and since(), or create one directly:
_10const film = Temporal.Duration.from({ hours: 2, minutes: 15 });_10_10film.toString(); // 'PT2H15M'_10film.total({ unit: 'minutes' }); // 135_10_10const longer = film.add({ minutes: 50 });_10longer.round({ largestUnit: 'hour' }).toString(); // 'PT3H5M'
Durations also format nicely for display with toLocaleString(), in environments that support Intl.DurationFormat:
_10film.toLocaleString('en-GB', { style: 'long' });_10// '2 hours, 15 minutes'
One subtlety: durations containing years, months or weeks do not have a fixed length. A month might be 28 or 31 days. Methods that need to know the real length, such as total() or Duration.compare() on calendar units, require a relativeTo option telling Temporal which date to measure from:
_10const oneMonth = Temporal.Duration.from({ months: 1 });_10_10oneMonth.total({_10 unit: 'days',_10 relativeTo: Temporal.PlainDate.from('2026-02-01'),_10}); // 28
Comparing values
#This is a place where Temporal deliberately differs from Date. With Date, you can write a < b because the object quietly converts to a number. Temporal objects throw a TypeError if you try that, to stop you from accidentally comparing values that do not mean the same thing.
Use equals() for equality and the static compare() for ordering:
_10const a = Temporal.PlainDate.from('2026-11-27');_10const b = Temporal.PlainDate.from('2026-12-25');_10_10a.equals(b); // false_10Temporal.PlainDate.compare(a, b); // -1_10_10const dates = [b, a];_10dates.sort(Temporal.PlainDate.compare); // [a, b]
compare() returns -1, 0 or 1, which is exactly the shape Array.prototype.sort() wants.
Temporal compared with Date
#Here are some common tasks side by side.
Getting tomorrow's date:
_10// Date_10const d = new Date();_10d.setDate(d.getDate() + 1); // mutates d_10_10// Temporal_10const tomorrow = Temporal.Now.plainDateISO().add({ days: 1 });
Creating 1 March 2026:
_10// Date: month index 2 means March_10new Date(2026, 2, 1);_10_10// Temporal: month 3 means March_10Temporal.PlainDate.from({ year: 2026, month: 3, day: 1 });
Showing a time in another zone:
_10// Date: only possible through formatting_10new Date().toLocaleString('en-GB', { timeZone: 'Asia/Tokyo' });_10_10// Temporal: a real value you can keep working with_10Temporal.Now.zonedDateTimeISO('Asia/Tokyo').add({ hours: 2 });
Moving between the two
You will be working alongside Date for a long time, especially with older libraries. Conversion is straightforward through Instant:
_10// Date to Temporal_10const legacy = new Date();_10const instant = legacy.toTemporalInstant();_10// or: Temporal.Instant.fromEpochMilliseconds(legacy.getTime())_10_10// Temporal to Date_10const back = new Date(instant.epochMilliseconds);
Serialising to JSON
Temporal objects turn into ISO 8601 strings with JSON.stringify(). When reading JSON back, you get strings, so parse them with the matching from() method:
_10const payload = JSON.stringify({ due: Temporal.PlainDate.from('2026-12-01') });_10// '{"due":"2026-12-01"}'_10_10const { due } = JSON.parse(payload);_10const dueDate = Temporal.PlainDate.from(due);
Using Temporal in TypeScript
#Recent versions of TypeScript include type definitions for Temporal under the newer lib options. If your setup does not recognise the global yet, the polyfill packages below ship their own types, and you can import Temporal from them directly.
Version support
#At the time of writing (late 2026):
- Firefox has shipped Temporal since version 139, released in 2025.
- Chrome and Edge shipped it in version 144, in January 2026.
- Node.js includes it from Node.js 26.
- Safari does not support it in a stable release yet. Work is under way in WebKit, but you should not assume it is there.
Because Safari is the default on every iPhone, you cannot use the global Temporal unguarded on a public website yet. There are two well-maintained polyfills:
@js-temporal/polyfill, from the champions of the proposal.temporal-polyfill, a smaller alternative.
You can import from a polyfill directly, which works everywhere:
_10npm install @js-temporal/polyfill
_10import { Temporal } from '@js-temporal/polyfill';_10_10const today = Temporal.Now.plainDateISO();
Or use the native object when it exists and load the polyfill only when it does not:
_10async function getTemporal() {_10 if (globalThis.Temporal) return globalThis.Temporal;_10 const { Temporal } = await import('@js-temporal/polyfill');_10 return Temporal;_10}
Polyfills add weight to your bundle, so check the current size before you add one, and plan to remove it once your supported browsers all ship Temporal natively. Check caniuse for the latest support data.
When not to use it
#- Simple timestamps in performance code. For measuring how long something took,
performance.now()is lighter and more precise for that job. - When a polyfill is too heavy. On a small page that only formats one date,
Intl.DateTimeFormatwith a plainDatemay be enough, and avoids shipping a polyfill to Safari users. - Mixing types carelessly. Temporal will not let you add a
PlainDateto aZonedDateTimewithout being explicit. If your code needs lots of conversions, step back and decide which type the data should really be. - Libraries that expect Date. Many date pickers, ORMs and charting libraries still take
Dateobjects. Convert at the boundary rather than fighting them.
Wrapping up
#- Choose the type that matches your data:
PlainDatefor calendar dates,ZonedDateTimefor real-world times in a place,Instantfor exact timestamps andDurationfor lengths of time. - Temporal objects are immutable and months start at 1, removing two of the biggest sources of
Datebugs. - Compare values with
equals()andcompare(), never with the less-than or greater-than operators. - Time zone and daylight saving maths are built in, so adding a day and adding 24 hours now mean different, correct things.
- Firefox, Chrome, Edge and Node.js have Temporal natively; use a polyfill for Safari until it ships there.
Related reading
#JavascriptWas this article helpful?

About the author
Danny Engineering
A software engineer with a strong belief in human-centric design and driven by a deep empathy for users. Combining the latest technology with human values to build a better, more connected world.