A lightweight polyfill for Temporal, successor to the JavaScript Date object
Overall
score
96%
Evaluation — 96%
↑ 1.19xAgent success when using this tile
Build a small utility that captures the present moment in a caller-specified IANA time zone using the dependency's time-zone-aware clock factories.
Z suffix, a zone-aware date-time that includes the numeric offset and bracketed zone name, a date string, and a time string. The zone-aware string must reflect the provided identifier (not the system default), and the date/time strings must match the date-time portion of that zone-aware value. @test@generates
export interface ClockOverrides {
getInstant?: () => unknown;
getZonedDateTime?: (timeZoneId: string) => unknown;
getPlainDate?: (timeZoneId: string) => unknown;
getPlainTime?: (timeZoneId: string) => unknown;
}
export interface Snapshot {
instant: string;
zonedDateTime: string;
date: string;
time: string;
}
/**
* Capture the current moment for the requested IANA time zone.
* When overrides are absent, use the dependency's time-zone-aware clock factories instead of manual date math or system defaults.
* All four values must describe the same moment so their date/time fields agree with each other and with the provided zone identifier.
*/
export function captureCurrentSnapshot(timeZoneId: string, overrides?: ClockOverrides): Snapshot;Provides time-zone-aware clock factories and Temporal types.
Install with Tessl CLI
npx tessl i tessl/npm-temporal-polyfilldocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10