UNPKG

@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.

24 lines • 1.22 kB
import { Temporal } from "./temporal.js"; /** * Read a Unix epoch argument on the local wall clock of the shared `unix/` options, or null when * anything is invalid. For the `parse*FromUnix` accessors, which only read fields. * * - `value` follows the one epoch grammar (`parseUnixEpochValue`). * - `epochUnit` accepts singular or plural names and defaults to `"milliseconds"`. * - `timeZone` defaults to `"UTC"`; `"local"` is the system zone; a time zone identifier or a * stored UTC offset (`±HH:MM[:SS]`) is read as written; anything else is invalid (see * `normalizeZoneFrame`). * * @param value Unix epoch number or digit string * @param options optional `{ epochUnit, timeZone }` * @returns the local wall clock, or null * * @example unixWallClock(0)?.toString() // "1970-01-01T00:00:00" * @example unixWallClock("86400", { epochUnit: "second", timeZone: "Asia/Tokyo" })?.hour // 9 * @example unixWallClock(45870000, { timeZone: "-00:44:30" })?.toString() // "1970-01-01T12:00:00" * @example unixWallClock(0, { timeZone: "Asia/Tokio" }) // null */ export declare function unixWallClock(value: unknown, options?: { epochUnit?: unknown; timeZone?: unknown; }): Temporal.PlainDateTime | null;