Safari Is Adding Temporal. It's Time to Stop Fighting JavaScript Dates
Safari 27.3 adds Temporal, the last big browser to do so. The six types you need, seven everyday recipes, and how to ship it today with a 20 KB fallback.
CarnielOn this page18 sections
Run this line on a laptop in Lagos and it prints the 27th. Run it on a laptop in New York and it prints the 26th.
new Date('2026-03-27').getDate()Nothing is wrong with either laptop. JavaScript reads a date-only string as midnight UTC, then shows it in local time. Lagos is one hour ahead of UTC, so midnight UTC is still the 27th. New York is behind UTC, so it becomes the evening of the 26th.
This is why Nigerian developers often miss the bug. Everything looks right on our machines. Then a customer in Houston or Toronto sees a delivery date that is one day early, and we spend an afternoon adding and subtracting hours until it goes away.
The fix the language has been working on for nine years is called Temporal, and it's almost everywhere now.
Where Temporal stands in November 2026
Temporal reached Stage 4 at TC39's March 2026 meeting, which makes it part of ECMAScript 2026 (daily.dev summary of the meeting). Firefox shipped it in version 139 back in May 2025, and Chrome and Edge followed in version 144 in January 2026 (web.dev). Node.js 26 has it without a flag.
Safari was the holdout, and on iPhone that matters: every browser on iOS uses Safari's engine. That changed on November 3, when the Safari 27.3 beta release notes listed support for Temporal (Apple). iOS 27.3 and macOS 27.3 are expected to reach everyone in early December (Macworld).
Can I Use puts global support at about 72% today (Can I Use). That number will jump once iPhones update, but plenty of phones lag behind on iOS updates for months. So the plan below is: write Temporal code now, ship a small fallback for older browsers, and delete the fallback later.
What Date gets wrong
Date uses one type for everything. A birthday, a meeting time, a timestamp in your database and a countdown are all the same object, and it always carries a time and a time zone whether you want them or not.
It's also mutable. date.setMonth(2) changes the object in place, so a helper that "just reads" a date can quietly change it for every other part of your app that holds the same reference.
Temporal splits these jobs into separate types, and every operation returns a new value instead of changing the old one.
The six types you'll actually use
Temporal.PlainDate: a calendar date with no time and no time zone. Birthdays, due dates, the day a promo ends.Temporal.PlainTime: a wall-clock time with no date. "We open at 9:00."Temporal.PlainDateTime: a date and a time, still with no time zone. Useful for form inputs before you know where the user is.Temporal.ZonedDateTime: a date and time in a named time zone likeAfrica/Lagos. Meetings, flights, anything people attend.Temporal.Instant: an exact moment on the global timeline. This is what you store in a database.Temporal.Duration: an amount of time, like 2 hours 15 minutes.
Pick the type that matches what the value means, and most date bugs never get a chance to happen.
Seven everyday jobs, done with Temporal
Every snippet below was run against temporal-polyfill 1.0.8 and Chrome 153's built-in Temporal, and the outputs in the comments are the real results.
1. A due date that's the same day everywhere
const due = Temporal.PlainDate.from('2026-03-27');
due.day; // 27, in Lagos, New York and Tokyo
due.add({ months: 1 }).toString() // '2026-04-27'A PlainDate has no time zone, so there is nothing to shift. This alone fixes the bug at the top of this post.
2. Adding a month without surprises
Temporal.PlainDate.from('2026-01-31').add({ months: 1 }).toString();
// '2026-02-28'With Date, January 31 plus one month rolls over into March 3. Temporal clamps to the last valid day of February, which is what a person would expect for a monthly subscription.
3. A Lagos stand-up, shown to the rest of the team
const standup = Temporal.ZonedDateTime.from('2026-11-20T09:30[Africa/Lagos]');
standup.withTimeZone('Europe/London').toPlainTime().toString(); // '08:30:00'
standup.withTimeZone('America/Toronto').toPlainTime().toString(); // '03:30:00'Lagos doesn't use daylight saving time, but London and Toronto do. Temporal looks up the correct offset for that exact date, so you never hard-code "+1" anywhere.
4. Storing a moment and reading it back
const stored = standup.toInstant().toString();
// '2026-11-20T08:30:00Z'
Temporal.Instant.from(stored).toZonedDateTimeISO('Africa/Lagos').toString();
// '2026-11-20T09:30:00+01:00[Africa/Lagos]'Store the Instant string in UTC. Convert to a time zone only when you show it to someone.
5. Days left until a deadline
const today = Temporal.PlainDate.from('2026-11-16');
const christmasEve = Temporal.PlainDate.from('2026-12-24');
today.until(christmasEve).days; // 38
today.until(christmasEve, { largestUnit: 'months' }).toString(); // 'P1M8D'No more dividing milliseconds by 86400000 and hoping no daylight saving change falls in between.
6. Sorting dates
const dates = ['2026-12-01', '2026-03-27', '2026-07-15'].map((s) =>
Temporal.PlainDate.from(s)
);
dates.sort(Temporal.PlainDate.compare).map(String);
// ['2026-03-27', '2026-07-15', '2026-12-01']Every Temporal type has a static compare that you can pass straight to sort.
7. Showing dates the Nigerian way
standup.toLocaleString('en-NG', { dateStyle: 'medium', timeStyle: 'short' });
// '20 Nov 2026, 09:30'
due.toLocaleString('en-NG', {
weekday: 'long', day: 'numeric', month: 'long', year: 'numeric',
});
// 'Friday, 27 March 2026'Formatting still goes through Intl, so you get day-month order and the right month names for free.
The daylight saving trap, solved
Here is one that catches even careful developers. In the UK, clocks go forward on March 29, 2026. Watch what "one day later" means:
const before = Temporal.ZonedDateTime.from('2026-03-28T12:00[Europe/London]');
before.add({ days: 1 }).toString();
// '2026-03-29T12:00:00+01:00[Europe/London]'
before.add({ hours: 24 }).toString();
// '2026-03-29T13:00:00+01:00[Europe/London]'Adding a day keeps the same wall-clock time. Adding 24 hours moves the exact moment forward 24 hours, which lands on 1 PM because an hour was skipped. Both are correct. Temporal makes you say which one you mean. If your app sends reminders to customers in the UK, US or Canada, this is the difference between a reminder at noon and one at 1 PM.
How to ship Temporal today
Until old iPhones age out, you need a fallback. The temporal-polyfill package from the FullCalendar team is the one to use. It's spec compliant, about 20 KB gzipped when minified, and it uses the browser's own Temporal when one exists.
npm install temporal-polyfillOption A: one shared module (simplest, works in Next.js)
// lib/temporal.ts
export { Temporal } from 'temporal-polyfill';Then import from that file everywhere, in Server Components, Client Components and API routes alike:
import { Temporal } from '@/lib/temporal';This matters on the server too. Node.js 22 and 24 don't have Temporal, so if your server runs either, the polyfill is what makes your server code work. The cost is that the 20 KB ships in your client bundle even to browsers that don't need it. When your analytics show old iOS traffic has dropped off, change that one file to read from globalThis and remove the package.
Option B: load the polyfill only where it's missing
For a Vite or other single-page app with an async entry point, you can skip the download for most visitors:
// main.js
if (!('Temporal' in globalThis)) {
await import('temporal-polyfill/global');
}The global entry installs Temporal on globalThis only when the browser lacks it. Chrome, Firefox and Safari 27.3 users never download it.
If page weight is something you think about, I wrote about measuring what your site costs visitors on mobile data. 20 KB is small, but it's still worth not sending when you don't have to.
TypeScript setup
TypeScript ships Temporal types in the esnext.temporal lib. Add it to your tsconfig.json:
{
"compilerOptions": {
"lib": ["ES2022", "DOM", "ESNext.Temporal"]
}
}That's enough for global Temporal code to type-check. If you import from temporal-polyfill as in Option A, the package brings its own types and you don't need this at all. If you're also moving to TypeScript 7, my TypeScript 7 migration notes for Next.js cover the other tsconfig changes.
Working alongside existing Date code
You don't have to rewrite your app this week. Temporal and Date convert cleanly at the edges:
// Date to Temporal
const legacy = new Date('2026-11-20T08:30:00Z');
Temporal.Instant.fromEpochMilliseconds(legacy.getTime())
.toZonedDateTimeISO('Africa/Lagos')
.toString();
// '2026-11-20T09:30:00+01:00[Africa/Lagos]'
// Temporal to Date, for a library that only accepts Date
new Date(standup.epochMilliseconds).toISOString();
// '2026-11-20T08:30:00.000Z'A sensible order is: use Temporal for new features, convert at the boundary when you call an older library, and replace date-fns or dayjs calls file by file as you touch them.
Where to start
Open your codebase and search for new Date('. Every result that parses a date-only string like '2026-03-27' is the bug from the top of this post waiting for a customer outside your time zone. Swap those to Temporal.PlainDate.from() first. It's a small change, and it removes a whole class of "it works on my machine" reports.