Skip to main content
Version: v0.0.6

Function: astmDateToLocalISO()

astmDateToLocalISO(d): string

Render an AstmDate as an ISO-8601-like string truncated to its precision, with no Z and no offset: because ASTM carries no timezone and appending one would fabricate information. A consumer that knows the instrument's zone can attach it; this function never assumes UTC.

Parameters

d

AstmDate

The date to render.

Returns

string

e.g. "2024-03-15T09:30" (minute precision) or "2024-03" (month).

Example

import { astmDateToLocalISO, parseAstmDate } from "@cosyte/astm";
astmDateToLocalISO(parseAstmDate("20240315")!); // "2024-03-15"