function toCanonicalIso
toCanonicalIso(value: string | undefined): string | undefined

Normalise a provider timestamp to the ledger's canonical ISO 8601 form (YYYY-MM-DDTHH:mm:ss.sssZ), or undefined when it's absent or unparseable.

Providers return assorted shapes — SumUp uses a +00:00 offset, Square may omit milliseconds — but the ledger validator accepts only the exact canonical form. Normalising here, where a session is built, keeps createdAt safe to use as a ledger occurredAt without a paid booking throwing at post time.

Parameters

value: string | undefined

Return Type

string | undefined

Usage

import { toCanonicalIso } from "doc.ts";