@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
16 lines (15 loc) • 558 B
TypeScript
import { type UnixUnit } from "../validate/isValidUnixUnit.js";
/**
* Return the current Unix timestamp in either seconds or milliseconds.
*
* - Uses Temporal.Now.instant() to get current time.
* - Defaults to "milliseconds" if no unit specified.
* - Returns 0 on failure.
*
* @param unit optional unit specifier: "seconds" | "milliseconds"
* @returns number (unix timestamp)
*
* @example getUnixNow() // 1700000000000
* @example getUnixNow("seconds") // 1700000000
*/
export declare function getUnixNow(...unitInput: [unit?: UnixUnit]): number;