getDayOfYear
Signature
Section titled “Signature”getDayOfYear(value: string): numberimport { getDayOfYear } from "@northguild/gmt/plain/calculate";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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value |
string |
ISO PlainDate string |
Returns
Section titled “Returns”1-366, or null on invalid input
Examples
Section titled “Examples”getDayOfYear("2024-01-01") // 1getDayOfYear("2024-12-31") // 366 (leap year)getDayOfYear("2023-12-31") // 365getDayOfYear("2024-03-01") // 61 (after the Feb 29 leap day)getDayOfYear("invalid") // null