typescript-temporal
Installation
SKILL.md
Temporal for Dates and Times
New TypeScript and JavaScript code handles dates and times with Temporal.
Date packs a calendar date, an instant and the host time zone into one
mutable object. The bugs that follow all type-check: yesterday's date just
after midnight, every date shifted a day west of UTC, weekday indexes off by
one. Temporal gives each meaning its own type, so mixing them becomes a compile
error.
Pick the type by what the value means
| The value is… | Type | Example |
|---|---|---|
| A calendar date with no time or zone (due date, holiday, timesheet day) | Temporal.PlainDate |
Temporal.PlainDate.from("2026-06-15") |
| A month (billing or reporting period) | Temporal.PlainYearMonth |
Temporal.PlainYearMonth.from("2026-02").daysInMonth is 28 |
| A wall-clock time, or date and time, with no zone ("09:00 every weekday") | Temporal.PlainTime / Temporal.PlainDateTime |
Temporal.PlainTime.from("09:00") |
A moment in time (log timestamp, created_at) |
Temporal.Instant |
Temporal.Now.instant() |
| A moment shown or bucketed in a place | Temporal.ZonedDateTime with an explicit IANA zone |
instant.toZonedDateTimeISO("Europe/Helsinki") |
| A length of time | Temporal.Duration |
Temporal.Duration.from({ hours: 7, minutes: 15 }).total("hours") is 7.25 |