@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.
20 lines • 925 B
TypeScript
/**
* Re-serialise instant intervals to `Temporal.Instant.prototype.toString()` spelling.
*
* The CORE-6 `interval/` functions echo the caller's strings; the positional `utc/interval/`
* functions that delegate to them return canonical `Z` strings instead (CORE-8 half-open decisions of record:
* outputs stay re-serialised), so tie-breaks between spellings of one instant never surface.
*
* - Returns `null` if any string fails to parse (callers validate first, so only a throwing
* `Temporal.Instant.from` reaches this).
*
* @example canonicalInstantIntervals([{ start: "2024-01-01T09:00:00.000Z", end: "2024-01-01T12:00Z" }]) // [{ start: "2024-01-01T09:00:00Z", end: "2024-01-01T12:00:00Z" }]
* @example canonicalInstantIntervals([]) // []
*/
export declare function canonicalInstantIntervals(intervals: ReadonlyArray<{
start: string;
end: string;
}>): Array<{
start: string;
end: string;
}> | null;