Skip to content

This site describes solve-engine as it is on main: 2.43.0, which npm does not have yet. npm installs 2.40.0, so a page may show an answer that version does not give yet.

TemporalCalendar

Defined in: packages/engine/src/temporal/TemporalCalendar.ts:208

A CalendarBackend over a Temporal implementation, computing in one named time zone. Build one with createTemporalCalendar.

Every method answers what the Date backend answers for the same inputs when the zone is the process’s own; see the module comment for the differences between Temporal and Date that are reproduced deliberately. The local methods answer NaN for an instant or a date the backend cannot represent and never throw; the four named-zone methods throw the runtime’s RangeError for a zone it does not know or an instant it cannot represent, which is the contract the interface states.

new TemporalCalendar(temporal, options?): TemporalCalendar;

Defined in: packages/engine/src/temporal/TemporalCalendar.ts:215

ParameterType
temporalTemporalLike
optionsTemporalCalendarOptions

TemporalCalendar

readonly timeZone: string;

Defined in: packages/engine/src/temporal/TemporalCalendar.ts:210

The IANA zone every local answer is computed in, in its canonical spelling.

addDays(epochMs, days): number;

Defined in: packages/engine/src/temporal/TemporalCalendar.ts:275

Move an instant by whole calendar days, holding the local wall-clock time. A day that contains a daylight-saving transition is 23 or 25 hours long, so this is a field step, not an addition of milliseconds.

ParameterType
epochMsnumber
daysnumber

number

CalendarBackend.addDays


addMonths(epochMs, months): number;

Defined in: packages/engine/src/temporal/TemporalCalendar.ts:282

Move an instant by whole calendar months, holding the local wall-clock time and clamping the day to the length of the month landed in: 31 January plus a month is 28 February, or 29 in a leap year, never 3 March.

ParameterType
epochMsnumber
monthsnumber

number

CalendarBackend.addMonths


fields(epochMs): CalendarFields;

Defined in: packages/engine/src/temporal/TemporalCalendar.ts:243

The local calendar fields of an instant, weekday included. See CalendarFields.

ParameterType
epochMsnumber

CalendarFields

CalendarBackend.fields


fieldsInZone(zone, epochMs): ZonedFields;

Defined in: packages/engine/src/temporal/TemporalCalendar.ts:389

The calendar date and wall-clock time a named IANA zone shows for an instant. Throws the runtime’s RangeError for a zone it does not know or an instant it cannot represent.

ParameterType
zonestring
epochMsnumber

ZonedFields

CalendarBackend.fieldsInZone


formatDateInZone(zone, epochMs): string;

Defined in: packages/engine/src/temporal/TemporalCalendar.ts:404

The calendar date in a named IANA zone, July 31, 2026, in the en-US style the timezone forms answer in. Throws the runtime’s RangeError for a zone it does not know or an instant it cannot represent.

ParameterType
zonestring
epochMsnumber

string

CalendarBackend.formatDateInZone


formatLongDate(epochMs, locale): string;

Defined in: packages/engine/src/temporal/TemporalCalendar.ts:355

The spelled-out local date in a locale, Tuesday, March 10, 2026 in en.

ParameterType
epochMsnumber
localestring

string

CalendarBackend.formatLongDate


formatTimeInZone(zone, epochMs): string;

Defined in: packages/engine/src/temporal/TemporalCalendar.ts:400

The wall-clock time in a named IANA zone, 1:00 AM, in the en-US style the timezone forms answer in. Throws the runtime’s RangeError for a zone it does not know or an instant it cannot represent.

ParameterType
zonestring
epochMsnumber

string

CalendarBackend.formatTimeInZone


formatTimeOfDay(epochMs, locale): string;

Defined in: packages/engine/src/temporal/TemporalCalendar.ts:365

The local time of day in a locale, 9:30:00 AM in en.

ParameterType
epochMsnumber
localestring

string

CalendarBackend.formatTimeOfDay


localMidnight(
year,
month0,
day
): number;

Defined in: packages/engine/src/temporal/TemporalCalendar.ts:259

Local midnight on a calendar date, in epoch milliseconds.

Fields overflow the way Date’s do (month 12 is January of the next year, day 0 the last day of the month before), which is what a caller checking for a rolled-over literal relies on: build the date, read its fields back, and a 30 February shows up as 1 or 2 March.

The year is taken as written, astronomically: 26 is 26 AD and 0 is 1 BC. The Date constructor’s reading of 0 to 99 as the 1900s is not part of the contract, because every year a caller passes is one read off a date or written out in full (#823). The same holds for localWallClock.

ParameterType
yearnumber
month0number
daynumber

number

CalendarBackend.localMidnight


localWallClock(
year,
month0,
day,
minutesPastMidnight
): number;

Defined in: packages/engine/src/temporal/TemporalCalendar.ts:263

A wall-clock time on a calendar date, given as minutes past local midnight, in epoch milliseconds.

The minutes name a clock reading, not an elapsed span: 540 minutes is 09:00 on that date even on a day with a daylight-saving transition, where 540 minutes of elapsed time from midnight would land at 10:00 or 08:00.

ParameterType
yearnumber
month0number
daynumber
minutesPastMidnightnumber

number

CalendarBackend.localWallClock


now(): number;

Defined in: packages/engine/src/temporal/TemporalCalendar.ts:239

The current instant, in epoch milliseconds. Read at evaluation time, never baked into bytecode.

number

CalendarBackend.now


parseIso8601(text): number;

Defined in: packages/engine/src/temporal/TemporalCalendar.ts:308

Parse an ISO 8601 date or date-time string to epoch milliseconds, or NaN when it names no instant.

A date-only string (2019-04-01) is UTC midnight; a date-time with no offset and no Z is local time. Both readings are the ECMAScript ones, and every backend reproduces them so the two spellings of a literal keep meaning the same instant whichever backend is in use.

ParameterType
textstring

number

CalendarBackend.parseIso8601


utcOffsetMinutes(epochMs): number;

Defined in: packages/engine/src/temporal/TemporalCalendar.ts:298

The local zone’s offset from UTC at an instant, in minutes, positive when ahead of UTC.

ParameterType
epochMsnumber

number

CalendarBackend.utcOffsetMinutes


zone(): string;

Defined in: packages/engine/src/temporal/TemporalCalendar.ts:396

The IANA zone this backend computes in, which is what CalendarBackend.zone documents.

string

CalendarBackend.zone


zoneOffsetMinutes(zone, epochMs): number;

Defined in: packages/engine/src/temporal/TemporalCalendar.ts:375

A named IANA zone’s offset from UTC at an instant, in minutes, positive when ahead of UTC. Throws the runtime’s RangeError for a zone it does not know or an instant it cannot represent.

ParameterType
zonestring
epochMsnumber

number

CalendarBackend.zoneOffsetMinutes