@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
18 lines (17 loc) • 746 B
TypeScript
import { type UnixUnit } from "../validate/isValidUnixUnit.js";
/**
* Convert a unix epoch value to a UTC Instant ISO string.
*
* - Converts to UTC Instant using Temporal.Instant.
* - Validates value and epoch unit ("seconds" | "milliseconds").
* - Returns "" for invalid input.
*
* @param value epoch value (number)
* @param unit optional unit, "seconds" or "milliseconds"
* @returns UTC Instant string or "" on invalid
*
* @example convertUnixToUtc(1709164800000) // "2024-02-29T00:00:00Z"
* @example convertUnixToUtc(1709164800, "seconds") // "2024-02-29T00:00:00Z"
* @example convertUnixToUtc(-1) // "1969-12-31T23:59:59.999Z"
*/
export declare function convertUnixToUtc(value: number, ...unitInput: [unit?: UnixUnit]): string;