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.

createTemporalCalendar

function createTemporalCalendar(temporal, options?): TemporalCalendar;

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

A calendar backend over the host’s Temporal, for the engine’s calendar option.

import { createEngine } from "solve-engine";
import { createTemporalCalendar } from "solve-engine/temporal";
const calendar = createTemporalCalendar(globalThis.Temporal, { timeZone: "Asia/Tokyo" });
const engine = createEngine({ calendar });
ParameterTypeDescription
temporalTemporalLikeThe Temporal implementation: globalThis.Temporal where the runtime ships one, or a polyfill’s export.
optionsTemporalCalendarOptionsThe zone to compute in and, for a test, the clock to read; see TemporalCalendarOptions.

TemporalCalendar

A backend that computes every date in that zone and answers what the Date backend would in it.

TEMPORAL_IMPLEMENTATION_INVALID when temporal lacks the members the backend uses, and TEMPORAL_TIME_ZONE_UNKNOWN when the implementation does not know the zone asked for.