Skip to main content
Version: v0.0.6

Interface: AstmDate

A parsed ASTM date/time. Immutable plain data; the populated fields extend exactly as far as AstmDate.precision. Absent components are left undefined rather than defaulted, so a consumer can tell "midnight" from "no time given". No timezone is modeled: the value is instrument-local.

Example

import { parseAstmDate } from "@cosyte/astm";
const d = parseAstmDate("20240315");
d?.precision; // "day"
d?.hour; // undefined (not 0)

Properties

day?

readonly optional day?: number


hour?

readonly optional hour?: number


minute?

readonly optional minute?: number


month?

readonly optional month?: number


precision

readonly precision: AstmDatePrecision

How far the components are populated.


raw

readonly raw: string

The raw digit string as it appeared on the wire.


second?

readonly optional second?: number


truncated?

readonly optional truncated?: true

true when the digit run does not align to a whole-component boundary: an odd number of digits that cuts a two-digit component (month/day/hour/minute/second) in half (lengths 5, 7, 9, 11, 13). The full run is preserved in AstmDate.raw and the structured value is truncated to the last complete component: the dangling digit is never zero-filled into a fabricated time. Absent (never false) for a clean value. A caller surfaces this as a value-free ASTM_RECORD_PARTIAL_TIMESTAMP warning.


year

readonly year: number