THE MEETUP
Monolith to Microfrontends and Temporal APIs
- Group
- JavaScript Meetup
- Talk
- Time Travel in JavaScript
TALK · JAVASCRIPT MEETUP
A tour of the Temporal API: why Date keeps breaking, what date libraries cost you, and how Temporal fixes it. Every example in the talk runs live, right here, in your browser and your time zone.
THE MEETUP
TIME TRAVEL IN JAVASCRIPT

PART 1


PART 2




PART 3
SINCE THE TALK Temporal reached Stage 4 in 2025.
PART 4
PlainDatePlainTimePlainDateTimeZonedDateTimeInstantDurationconst date = Temporal.PlainDate.from('2023-04-18'); // Creates a PlainDate object from a string.
const newDate = date.add({ days: 5 }); // Adds 5 days to the date.
press Run
const date = Temporal.PlainDate.from('2023-04-18'); // Creates a PlainDate object from a string.
const previousDate = date.subtract({ weeks: 1 }); // Subtracts 1 week from the date.
press Run
const date = Temporal.PlainDate.from('2023-04-18'); // Creates a PlainDate object from a string.
const duration = date.until(Temporal.PlainDate.from('2023-04-25')); // Duration until April 25, 2023.
press Run
PART 5 · LIVE
Checking your browser for Temporal…
1:00 AM in New York on 12 March 2023, just before the clocks jump forward. Add one day.
// Adding a day across the DST boundary with Date
const initialDate = new Date('2023-03-12T01:00:00-05:00'); // 1 AM in New York
const resultDate = new Date(initialDate.getTime() + 24 * 60 * 60 * 1000); // "one day later"
resultDate.toLocaleString('en-US', { timeZone: 'America/New_York' });
press Run
// Adding days with Temporal, considering DST
const initialDate = Temporal.ZonedDateTime.from('2023-03-12T01:00[America/New_York]');
const resultDate = initialDate.add({ days: 1 });
resultDate.toString();
press Run
Updated since the talk. The slide added a day with setDate(), which keeps wall-clock time; the bug people actually ship is adding 24 hours. The Temporal side now uses ZonedDateTime: a PlainDateTime has no time zone, so it never sees DST.
Both run on a one-second tick in your own time zone. Count the lines of arithmetic.
function timeUntilNewYear() {
const now = new Date();
const year = now.getFullYear();
const newYear = new Date(year + 1, 0, 1); // January 1st of next year
const diff = newYear - now;
const days = Math.floor(diff / (1000 * 60 * 60 * 24));
const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((diff % (1000 * 60)) / 1000);
return { days, hours, minutes, seconds };
}
press Run
function timeUntilNewYear() {
const now = Temporal.Now.zonedDateTimeISO();
const newYear = Temporal.PlainDate
.from({ year: now.year + 1, month: 1, day: 1 })
.toZonedDateTime(now.timeZoneId);
const left = now.until(newYear, { largestUnit: 'days', smallestUnit: 'seconds' });
return `${left.days} days, ${left.hours} hours, ${left.minutes} minutes, ${left.seconds} seconds`;
}
press Run
Updated since the talk. PlainDate.at() was replaced by toPlainDateTime() and toZonedDateTime(), and a Duration built from seconds isn't balanced into hours, so the slide's version now throws. until() with largestUnit does the balancing for you.
Try your own birthday.
function calculateAge(birthdate, currentDate) {
const birth = new Date(birthdate);
const current = new Date(currentDate);
let age = current.getFullYear() - birth.getFullYear();
const m = current.getMonth() - birth.getMonth();
if (m < 0 || (m === 0 && current.getDate() < birth.getDate())) {
age--;
}
return age;
}
press Run
function calculateFullAge(birthdate, currentDate) {
const birth = Temporal.PlainDate.from(birthdate);
const current = Temporal.PlainDate.from(currentDate);
const age = current.since(birth, { largestUnit: 'years' });
return `${age.years} years, ${age.months} months, and ${age.days} days`;
}
press Run
Watch out: new Date('1990-04-15') is read as midnight UTC. West of Greenwich, getDate() then returns the 14th, so the Date version can be a day out around a birthday.
Noon in New York on 18 April 2023. What time is it in Los Angeles?
// Convert a date-time from New York to Los Angeles time using the Date object
const dateInNewYork = new Date('2023-04-18T12:00:00Z');
const offsetNewYork = -240; // Offset for New York in minutes (EDT)
const offsetLosAngeles = -420; // Offset for Los Angeles in minutes (PDT)
const dateInLosAngeles = new Date(dateInNewYork.getTime() - (offsetLosAngeles - offsetNewYork) * 60 * 1000);
dateInLosAngeles.toISOString(); // Output is approximate and error-prone
press Run
// Using Temporal to handle time zone conversion accurately
const dateInNewYork = Temporal.ZonedDateTime.from('2023-04-18T12:00[America/New_York]');
const dateInLosAngeles = dateInNewYork.withTimeZone('America/Los_Angeles');
const dateWhereYouAre = dateInNewYork.withTimeZone(Temporal.Now.timeZoneId());
press Run
Updated since the talk. ZonedDateTime.from() no longer takes a { timeZone, plainDateTime } object; pass a string with the zone in brackets, or build it with PlainDateTime.toZonedDateTime().
Not ready for production!
UPDATE, OCTOBER 2026
That was true on the night. Since then Temporal reached Stage 4 (2025) and ships in Firefox 139 (May 2025) and Chrome 144 (January 2026). Safari still lacks the full API, so this page loads a small polyfill there.