@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
21 lines (20 loc) • 838 B
TypeScript
import { type UnixUnit } from "../validate/index.js";
/**
* Return the week number from a unix epoch value.
*
* - By default uses ISO weeks (Monday-based).
* - Returns null for invalid input.
*
* @param value unix epoch in milliseconds or seconds (number or string)
* @param options optional: epochUnit ("seconds" | "milliseconds"), timeZone (IANA), weekStartsOn ("monday" | "sunday")
* @returns Week number (1-53) or null on invalid input
*
* @example parseWeekFromUnix(1704067200000) // 1
* @example parseWeekFromUnix(1704067200000, { weekStartsOn: "sunday" }) // 1
* @example parseWeekFromUnix(-86400, { epochUnit: "seconds" }) // 1
*/
export declare function parseWeekFromUnix(value: number | string, options?: {
epochUnit?: UnixUnit;
timeZone?: string;
weekStartsOn?: "monday" | "sunday";
}): number | null;