Syntax
Temporal.Now.plainDateISO()
Temporal.ZonedDateTime.from(...)Examples
Getting the Current Date and Time
Temporal separates "what date is it" from "what time is it" into distinct, purpose-built types.
const today = Temporal.Now.plainDateISO();
console.log(today.toString()); // e.g. "2026-07-20"
const now = Temporal.Now.zonedDateTimeISO("Europe/London");
console.log(now.toString()); // includes an explicit, real IANA time zoneImmutable Date Arithmetic
Every operation returns a new object - the original is never mutated, unlike Date.
const date = Temporal.PlainDate.from("2026-01-15");
const nextMonth = date.add({ months: 1 });
console.log(date.toString()); // "2026-01-15" - unchanged
console.log(nextMonth.toString()); // "2026-02-15" - a brand new objectReal Time Zone Support
Working correctly across time zones, something the legacy Date object could never do natively.
const meeting = Temporal.ZonedDateTime.from({
timeZone: "America/New_York",
year: 2026, month: 8, day: 10,
hour: 14, minute: 0
});
const londonTime = meeting.withTimeZone("Europe/London");
console.log(meeting.toString());
console.log(londonTime.toString()); // same instant, correctly convertedBest practices
- Use Temporal for new projects going forward - it directly solves the time zone and mutability problems that made Date libraries like moment.js and date-fns necessary
- Check current browser/runtime support before relying on it in production without a polyfill - as of mid-2026 it ships natively in Chrome and Firefox, with Edge experimental and Safari still in Technical Preview
- Choose the most specific Temporal type for your use case - PlainDate for a calendar date with no time/zone, ZonedDateTime when time zone matters, Duration for elapsed time
- Use a polyfill (like @js-temporal/polyfill) for cross-browser compatibility until support is universal
At a glance
- Purpose
- Application logic and interaction
- File extension
- .js ยท .mjs
- Runs in
- Browsers and JavaScript runtimes
- Usually used with
- HTML, CSS and Web APIs
Specifications & further reading
Related JavaScript documentation
The Date object represents a single moment in time. new Date() with no arguments creates the current date/time; it also accepts a specific date, individual components (year, month, day...), or a timestamp. Getter methods like getFullYear(), getMonth(), and getDate() extract individual components - note that getMonth() is zero-indexed (0 = January).Date: Setting and Formatting
Setter methods like setFullYear() and setDate() modify a Date object in place. Formatting methods convert a Date into a readable string: toDateString() and toTimeString() give simple readable formats, toISOString() gives the standardized ISO 8601 format (useful for APIs), and toLocaleDateString() formats according to a locale's conventions.Arrow Functions
Arrow functions provide a more concise syntax for writing function expressions in JavaScript. Introduced in ES6, they use the => syntax and have some important differences from regular functions, particularly in how they handle the "this" keyword. Arrow functions are especially useful for callbacks, array methods, and short inline functions.Async/Await
Async/await is modern JavaScript syntax for handling asynchronous operations, making asynchronous code look and behave like synchronous code. The async keyword marks a function as asynchronous, and await pauses execution until a Promise resolves. This approach makes asynchronous code more readable and easier to understand than traditional Promise chains or callbacks.