UNPKG

@burglekitt/gmt

Version:

Temporal-based date and time utilities with timezone support and polyfill integration

19 lines (18 loc) 897 B
import { type UnixUnit } from "../../unix/validate/isValidUnixUnit.js"; /** * Convert a unix epoch value to a zoned ISO 8601 datetime string. * * - Converts to ZonedDateTime using the specified timezone. * - Validates value, timezone, and epoch unit. * - Returns "" for invalid input. * * @param value epoch value (number) * @param timeZone IANA timeZone identifier * @param unit optional unit, "seconds" or "milliseconds" * @returns zoned ISO 8601 string or "" on invalid * * @example convertUnixToZoned(1709164800000, "America/New_York") // "2024-02-29T00:00:00-05:00[America/New_York]" * @example convertUnixToZoned(1709164800, "UTC", "seconds") // "2024-02-29T00:00:00+00:00[UTC]" * @example convertUnixToZoned(-1, "UTC") // "1969-12-31T23:59:59.999Z[UTC]" */ export declare function convertUnixToZoned(value: number, timeZone: string, ...unitInput: [unit?: UnixUnit]): string;