@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
19 lines (18 loc) • 752 B
TypeScript
/**
* Return the week number for a given ISO 8601 datetime string.
*
* - By default uses ISO weeks (Monday-based).
* - Returns null for invalid input.
*
* @param value ISO 8601 datetime string
* @param optionsArg optional: weekStartsOn ("monday" | "sunday") for week calculations
* @returns Week number (1-53) or null on invalid input
*
* @example parseWeekFromDateTime("2024-01-01T12:00:00") // 1
* @example parseWeekFromDateTime("2024-01-08T00:00:00") // 2
* @example parseWeekFromDateTime("2024-01-01T00:00:00", { weekStartsOn: "sunday" }) // 1
* @example parseWeekFromDateTime("invalid") // null
*/
export declare function parseWeekFromDateTime(value: string, optionsArg?: {
weekStartsOn?: "monday" | "sunday";
}): number | null;