@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
17 lines (16 loc) • 589 B
TypeScript
/**
* Return the ordinal day-of-year (1-based) for `value`.
*
* - Jan 1 is 1; Dec 31 is 365 (common year) or 366 (leap year).
* - Returns null on invalid input.
*
* @param value ISO PlainDate string
* @returns 1-366, or null on invalid input
*
* @example getDayOfYear("2024-01-01") // 1
* @example getDayOfYear("2024-12-31") // 366 (leap year)
* @example getDayOfYear("2023-12-31") // 365
* @example getDayOfYear("2024-03-01") // 61 (after the Feb 29 leap day)
* @example getDayOfYear("invalid") // null
*/
export declare function getDayOfYear(value: string): number | null;