Loading lesson path
Temporal is the new standard for date and time in JavaScript. New Temporal objects were designed to replace the old Date object. Unlike legacy Date, Temporal objects are immutable and provide first-class support for time zones, daylight saving time, date arithmetic and non-Gregorian calendars.
Date object was created in 1995 and has some design issues that still cause bugs today. For example, months in
Formula
Date are zero - based, which is confusing.let d = new Date(2026, 5, 17); // Month 5 = JuneDate methods change the same object (mutation), which can create unexpected results.
// Create a Date let d = new Date(2026, 5, 17);
// Add 7 days d.setDate(d.getDate() + 7);
// Here the original date (d) is lostTemporal was created to solve these issues with clearer object types and predictable behavior.
With Temporal, you can get today's date and add days in a clear and safe way.
// Create a Temporal object const today = Temporal.Now.plainDateISO();Formula
// Add a duration const nextWeek = today.add({ days: 7 });JavaScript Date, you only have one type of date object.
let d = new Date();Temporal gives you separate objects depending on what you need:
Formula
- For time zone - aware appsTemporal objects are immutable, which means they cannot be changed after they are created.
Temporal objects return a new value instead of modifying the existing one.Formula
DST - safe arithmetic ensures time calculations (addition and subtraction) remain accurate across
Daylight Saving Time (DST) transitions, preventing 1 - hour errors.
It involves using timezone and calendar - aware objects (ZonedDateTime) that understand local clock shifts.