@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.
16 lines • 714 B
TypeScript
import { Temporal } from "./temporal.js";
/**
* The check behind `isValidUtc`: the `Instant` a strict ISO 8601 UTC date-time string names, or
* `null`.
*
* The whole string must match `utcDateTime` (`…Z`, nothing after, no annotation of any kind) and
* have no second 60; Temporal then reads the instant.
*
* @param value the candidate; a value that is not a string is not a UTC string
* @returns the `Instant` Temporal reads, else `null`
*
* @example utcInstantOf("2024-03-10T12:00:00Z")?.epochMilliseconds // 1710072000000
* @example utcInstantOf("2024-03-10T12:00:00") // null
* @example utcInstantOf(null) // null
*/
export declare function utcInstantOf(value: unknown): Temporal.Instant | null;