Function: toFhirDateTime()
toFhirDateTime(
ts,options?):ConvertResult<string>
Convert a parsed HL7 v2 timestamp to a FHIR dateTime lexical string, fail-safe on timezone and
precision. Returns { value: undefined } only when the timestamp is unparseable.
Parameters
ts
TS
A parsed @cosyte/hl7 TS (DtmParts).
options?
TransformOptions = {}
Conversion policy; assumeTimezoneOffsetMinutes supplies a sender-asserted offset.
Returns
ConvertResult<string>
Example
import { parseDtm } from "@cosyte/hl7";
import { toFhirDateTime } from "@cosyte/transform";
const { value } = toFhirDateTime(parseDtm("20260721"));
// value === "2026-07-21"
void value;