Sub topic 4
Reading the Current Time with Temporal.Now
This chapter assumes you can run ES modules in Node.js or a browser and that you have Temporal available, either natively or through the polyfill from the earlier chapter. It also assumes you know the difference between exact time and wall-clock time.
Temporal.Now is a namespace object. It has no constructor. It holds a set of functions, and each one reads the system clock and returns a value of a specific Temporal type. You choose the function by the type you need.
The Functions on Temporal.Now
| Function | Returns | Depends on time zone? |
|---|---|---|
| `Temporal.Now.instant()` | `Temporal.Instant` | No |
| `Temporal.Now.timeZoneId()` | String such as `'Europe/Paris'` | Is the time zone |
| `Temporal.Now.zonedDateTimeISO(tz?)` | `Temporal.ZonedDateTime` | Yes |
| `Temporal.Now.plainDateTimeISO(tz?)` | `Temporal.PlainDateTime` | Yes |
| `Temporal.Now.plainDateISO(tz?)` | `Temporal.PlainDate` | Yes |
| `Temporal.Now.plainTimeISO(tz?)` | `Temporal.PlainTime` | Yes |
The ISO suffix means the result uses the ISO 8601 calendar. If you leave out the optional time zone argument, the function uses the system time zone reported by timeZoneId().
Reading the Clock
import { Temporal as TemporalPolyfill } from '@js-temporal/polyfill';
const Temporal = globalThis.Temporal ?? TemporalPolyfill;
const now = Temporal.Now.instant();
console.log(now.toString()); // e.g. '2026-11-25T11:08:09.780123456Z'
console.log(now.epochMilliseconds); // e.g. 1795604889780
console.log(Temporal.Now.timeZoneId()); // e.g. 'UTC' or 'Europe/London'
// Today's date in a specific zone, independent of the machine's settings
const tokyoToday = Temporal.Now.plainDateISO('Asia/Tokyo');
console.log(tokyoToday.toString()); // e.g. '2026-11-25'
const meetingClock = Temporal.Now.zonedDateTimeISO('America/New_York');
console.log(meetingClock.hour); // e.g. 6Common Errors
Relying on the server's time zone
Temporal.Now.plainDateISO() with no argument gives "today" for whatever zone the process runs in. A server running in UTC and a laptop in Sydney can return different dates at the same instant. When the date belongs to a user, pass that user's time zone explicitly.
Reading the clock more than once
Each call reads the clock again. Code that calls plainDateISO() and then plainTimeISO() can straddle midnight and combine a date and a time that never existed together. Take one snapshot and derive the other values from it:
import { Temporal as TemporalPolyfill } from '@js-temporal/polyfill';
const Temporal = globalThis.Temporal ?? TemporalPolyfill;
const snapshot = Temporal.Now.zonedDateTimeISO('Europe/Berlin');
const date = snapshot.toPlainDate();
const time = snapshot.toPlainTime();
console.log(`${date} ${time}`);Calling removed functions
Older drafts had Temporal.Now.plainDate(calendar) and similar functions that took a calendar argument. The current API keeps only the ISO versions. If you need another calendar, call withCalendar() on the result.
Exercise
A function builds a timestamp label by calling Temporal.Now.plainDateISO() and then Temporal.Now.plainTimeISO() on a server set to UTC, for users in India. Name two problems and give a fix.
Show answer
The values come from two separate clock reads, so near midnight the date and time can come from different days. Both calls also use the server's UTC zone instead of the user's zone, so the date can be wrong for India. Fix: take one snapshot with Temporal.Now.zonedDateTimeISO('Asia/Kolkata') and derive the parts with toPlainDate() and toPlainTime().