Temporal (the TC39 Temporal proposal, with the ECMA-402 integration and the era and month-code proposal) is built in:
Temporal.Instant, ZonedDateTime, PlainDateTime, PlainDate, PlainTime, PlainYearMonth, PlainMonthDay,
Duration and Temporal.Now, plus Date.prototype.toTemporalInstant. The code is in Builtins/Temporal/; calendars come
from the calendar core described in calendars.md.
What comes from the host
Nothing in Temporal reads the machine clock or zone.
| Need | Host member | Notes |
|---|---|---|
Temporal.Now.* instant | IJsHost.CurrentTimeMs() | recorded like Date.now() |
the system zone, Temporal.Now.timeZoneId() | IJsHost.TimeZoneId | |
| offset of a zone at an instant | IJsHost.TryGetTimeZoneOffset | whole milliseconds, with the daylight flag |
| the next or previous offset change | IJsHost.TryGetTimeZoneTransition(zone, ms, forward, out transition) | used by ZonedDateTime.getTimeZoneTransition, startOfDay in gap days, and rounding |
TryGetTimeZoneTransition has a default that samples the offset function: 4-day steps find an interval whose ends
differ, bisection narrows it to the millisecond. The search looks 366 days ahead at least and up to the year 2200
(back to 1800), and it jumps over ranges that cannot hold a rule: from before 1800 it bisects once to the first change,
and from past 2200 a year with no change means none (rules repeat yearly there), so searches from the edges of the
Temporal range cost a few hundred offset calls. A host with exact tz rules overrides the member and answers directly.
The answer is recorded in the record log as ZoneTransition (tag 40) and replays without the host.
Offsets come from the embedded tzdata 2025b (TzdbSource), so they have seconds where tzdata does (local mean time before
standardization) and do not depend on the operating system. A host may supply its own offsets instead.
Choices the specifications leave open
- Messages. Temporal errors use this engine's own wording (
Invalid Temporal.PlainDate string "2024-13-45": the date does not exist). V8's messages for Temporal errors are generic and carry an internal source location, so they are not reproduced; the error names (RangeError,TypeError) match, and the golden casesrun-067torun-073record the reports. - Non-ISO month-day reference years follow ECMA-402's NonISOMonthDayToISOReferenceDate (latest match in 1900-1972, else the earliest in 1973-2035). With a year given, the day is constrained against that year's month first, and a year outside +-300000 is a RangeError before any month information is computed.
- Time zone links.
CST6CDT,EST5EDT,MST7MDTandPST8PDTare links of America/Chicago, New_York, Denver and Los_Angeles as in tzdata 2025b;ZonedDateTime.equalsandIntl.DateTimeFormatcompare zones by canonical identifier, andtimeZoneIdkeeps the spelling given. roundto a day when midnight happens twice. When the instant is on the second pass of the date's repeated hours, it is past the next date's first start; the result is the start of that date for floor and trunc and the start of the next date for every other mode, never an instant between them.- Duration rounding. The nudge window for a start duration with a date part begins at the start duration itself (the specification text's r1 = 0 contradicts the conformance tests).
- Strings. Calendar annotation values accept any alphanumeric components;
InstantandPlainTimestrings ignore unknown calendar annotations, as the grammar says they are not interpreted. - Intl.DurationFormat takes a
Temporal.Duration(read from its slots, no getters run), a duration string, or a record.
Limits
The Temporal range (+-8.64e21 ns, and the date range -271821-04-19 to +275760-09-13) is enforced everywhere a result is made. Loops
that grow with a script-controlled count are charged fuel: DateUntil and date addition balance months through
the calendar, and calendars with a variable number of months per year (hebrew, chinese, dangi) pay one step per 4 months
balanced. Duration arithmetic on large values uses exact integers (BigInteger) and rounds exactly.
Formatting
Intl.DateTimeFormat accepts Temporal objects (format, formatToParts, formatRange, formatRangeToParts) and every
type has toLocaleString. A plain type is formatted from its wall-clock fields as if in UTC; each type has its own
format derived lazily from the constructor options (ForTemporal): a PlainDate keeps date fields and drops time and
zone name, a PlainTime the reverse, PlainYearMonth and PlainMonthDay only their fields. dateStyle and timeStyle
formats keep the style when it uses only fields the type has and otherwise fall back to the closest field format
(ECMA-402 AdjustDateTimeStyleFormat). A ZonedDateTime is formatted only by its own toLocaleString (it is a TypeError
for format), in its own zone, with a timeZoneName default of short; offset zones show GMT+1 and a zero offset
shows the GMT metazone name (GMT). A calendar other than iso8601 must equal the formatter's calendar, else RangeError.
The formatter's calendar is any supported calendar; a plain date is formatted in it from its ISO fields.