UNPKG

@northguild/gmt

Version:

Date and time library for JavaScript and TypeScript, built on TC39 Temporal: time zones, DST, business days, ISO 8601 strings in and out. Never throws.

17 lines • 724 B
/** * Return the number of days in the calendar year containing `value`. * * - 365 for a common year, 366 for a leap year. * - It measures the calendar year that holds the date, not the next 12 months. From 2027-06-15 it * returns `365`, while `totalUnitsFromNow({ years: 1 }, "days")` returns `366`: the next 12 * months from that date take in 29 February 2028. * - Returns null on invalid input. * * @param value ISO PlainDate string * @returns 365 or 366, or null on invalid input * * @example getDaysInYear("2024-06-15") // 366 (leap year) * @example getDaysInYear("2023-06-15") // 365 * @example getDaysInYear("invalid") // null */ export declare function getDaysInYear(value: string): number | null;