@northguild/gmt
Version:
Date and time library for JavaScript and TypeScript, built on TC39 Temporal: time zones, DST, business days, ISO 8601 strings in and out. Never throws.
22 lines • 1.09 kB
TypeScript
import { FhirDateTime, FhirDateType, FhirPrecision } from "../types/fhir.js";
import "../types/index.js";
/** FHIR precisions, coarsest first. */
export declare const FHIR_PRECISIONS: readonly FhirPrecision[];
/**
* The precisions each type allows: `date` has no time, `instant` is at least to the second, and
* `dateTime` takes all five (R4 Datatypes §2.24.0.1).
*/
export declare const FHIR_TYPE_PRECISIONS: Readonly<Record<FhirDateType, readonly FhirPrecision[]>>;
/**
* True when `type` is a FhirDateType and allows `precision`. An own-key check, so `"toString"`
* is false.
*/
export declare function fhirTypeAllows(type: unknown, precision: FhirPrecision): boolean;
/**
* The core of `parseFHIR`, `isValidFHIR` and `formatFHIR`'s final check. Never throws.
*
* The pattern reads the form, Temporal reads the values: a month or day that does not exist is
* refused, a second of `60` only on an inserted leap second (GMT rule, SPA-48's table), and a
* fraction of more than nine digits not at all.
*/
export declare function readFhirValue(value: unknown): FhirDateTime | null;