Timestamp objects are immutable plain objects with calendar date fields and optional time fields. The standard parser helpers produce Gregorian fields. Calendar adapter helpers can produce the same shape with adapter fields and a calendarId.
import type { type CalendarId = "gregorian" | (string & {})Stable identifier for a calendar implementation.
The built-in Gregorian adapter uses `gregorian` as its package-facing id and
`gregory` as its Intl calendar id.CalendarId } from '@timestamp-js/core'
export interface Timestamp {
readonly Timestamp.calendarId?: CalendarId | undefinedcalendarId?: type CalendarId = "gregorian" | (string & {})Stable identifier for a calendar implementation.
The built-in Gregorian adapter uses `gregorian` as its package-facing id and
`gregory` as its Intl calendar id.CalendarId
readonly Timestamp.date: stringdate: string
readonly Timestamp.hasDay: booleanhasDay: boolean
readonly Timestamp.year: numberyear: number
readonly Timestamp.month: numbermonth: number
readonly Timestamp.day: numberday: number
readonly Timestamp.time?: string | undefinedtime?: string
readonly Timestamp.hasTime: booleanhasTime: boolean
readonly Timestamp.hour: numberhour: number
readonly Timestamp.minute: numberminute: number
readonly Timestamp.second?: number | undefinedsecond?: number
readonly Timestamp.millisecond?: number | undefinedmillisecond?: number
readonly Timestamp.timezone?: string | undefinedtimezone?: string
readonly Timestamp.weekday?: number | undefinedweekday?: number
readonly Timestamp.doy?: number | undefineddoy?: number
readonly Timestamp.workweek?: number | undefinedworkweek?: number
readonly Timestamp.past?: boolean | undefinedpast?: boolean
readonly Timestamp.current?: boolean | undefinedcurrent?: boolean
readonly Timestamp.future?: boolean | undefinedfuture?: boolean
readonly Timestamp.disabled?: boolean | undefineddisabled?: boolean
}Important fields
| Field | Meaning |
|---|---|
calendarId | Optional calendar-system id for adapter-produced timestamps. |
date | Calendar date string in YYYY-MM-DD form when present. |
time | Time string formatted as HH:mm, HH:mm:ss, or HH:mm:ss.SSS. |
hasDay | True when the timestamp includes a meaningful date/day value. |
hasTime | True when the timestamp includes time fields. |
weekday | Weekday number where Sunday is 0 and Saturday is 6. |
doy | Day of the year. |
workweek | Week number metadata for the timestamp calendar. |
timezone | Preserved timezone suffix such as Z, +06:00, or -0700. |
past | True when the timestamp is before a comparison timestamp. |
current | True when the timestamp matches a comparison timestamp. |
future | True when the timestamp is after a comparison timestamp. |
disabled | True when this timestamp represents a disabled date. |
Hover documentation
The source is documented with TypeScript/JSDoc comments so editors can show field and helper details on hover.