Creates a CalendarDate from an ISO date string, three 1-indexed numbers, a fields object, or an existing date or timestamp. Impossible dates such as February 30 throw a RangeError instead of rolling into March.
Extracts the calendar date in that instance’s own time zone.
JavaScript Date
date(jsDate, 'America/Los_Angeles')
Reads the calendar day of that timestamp in the given zone or configured default.
Temporal value
Temporal.PlainDate, Temporal.ZonedDateTime
Extracts the ISO calendar date.
Instant strings require a time zone
An ISO string with a trailing Z or UTC offset names a moment that can fall on two different calendar days around the world. Call datetime(text, zone).date to choose the time zone explicitly, or pass a zone in loose mode with @native-dates/plugins/loose.
Relative calendar days
Today’s date depends on where you stand on Earth. Each helper below accepts an optional time zone and falls back to your configured default.
today()
today(zone?): CalendarDate
Returns today’s calendar date in the given time zone or your configured default. Late in the evening in the Americas, Asia and Oceania have already crossed midnight into the next calendar date.
Parameters
zoneZone
Time zone whose current calendar date to read, such as 'Asia/Tokyo' or 'America/Los_Angeles'.
Returns
CalendarDate
Today's CalendarDate in zone.
import { datetime, today } from 'native-dates';const inLosAngeles = today('America/Los_Angeles');const inTokyo = today('Asia/Tokyo');// At 02:00 UTC on Nov 17, Los Angeles is still on Nov 16 while Tokyo is on Nov 17const moment = '2026-11-17T02:00:00Z';datetime(moment, 'America/Los_Angeles').date.toString(); // '2026-11-16'datetime(moment, 'Asia/Tokyo').date.toString(); // '2026-11-17'
tomorrow()
tomorrow(zone?): CalendarDate
Returns tomorrow’s calendar date in the given time zone, one calendar day after today(zone).