Interface: DtmParts
Parsed HL7 v2 TS/DTM value: the raw string plus its structural parts, with
the stated precision and timezone fidelity preserved. This is the
shape of the TS composite (field.asTs()) and every helper datetime.
The parts are only populated when valid is true. month/day/… are
spec-native (month is 1–12, NOT the JS Date 0–11). offsetMinutes
is present iff hasTimezone is true and is signed minutes east of UTC
(+0500 → 300, -0430 → -270). A missing offset is flagged
(hasTimezone: false), never resolved to UTC: the consumer decides how to
localize with dtmToDate.
Example
import type { DtmParts } from "@cosyte/hl7";
const dob: DtmParts = {
raw: "19880705", valid: true, precision: "day",
year: 1988, month: 7, day: 5, hasTimezone: false,
};
Properties
day?
readonlyoptionalday?:number
Day of month, 1–31.
fractionalSeconds?
readonlyoptionalfractionalSeconds?:string
Fractional-second digits exactly as populated (no leading dot), e.g.
"5" (0.5 s), "0500" (0.05 s). Preserved verbatim: never rounded.
hasTimezone
readonlyhasTimezone:boolean
true iff an explicit +/-ZZZZ offset was present.
hour?
readonlyoptionalhour?:number
Hour, 0–23.
matchedFormat?
readonlyoptionalmatchedFormat?:string
The fallback format that matched (parseDtmCascade only), e.g.
"MM/DD/YYYY" or "ISO-8601". Absent for a strict HL7 DTM parse.
minute?
readonlyoptionalminute?:number
Minute, 0–59.
month?
readonlyoptionalmonth?:number
Month, 1–12 (spec-native, NOT JS 0–11).
offsetMinutes?
readonlyoptionaloffsetMinutes?:number
Signed minutes east of UTC; present iff hasTimezone is true.
precision?
readonlyoptionalprecision?:DtmPrecision
Stated precision; absent when valid is false.
raw
readonlyraw:string
The original HL7 string, exactly as it appeared (already unescaped).
second?
readonlyoptionalsecond?:number
Second, 0–59.
valid
readonlyvalid:boolean
true when raw is a well-formed, in-range HL7 DTM (or a matched
fallback format). false for empty, malformed, or calendar-out-of-range
input: in which case only raw and hasTimezone: false are meaningful.
year?
readonlyoptionalyear?:number
Four-digit year.