UNPKG

861 BTypeScriptView Raw
1/**
2 * @name getISOWeekYear
3 * @category ISO Week-Numbering Year Helpers
4 * @summary Get the ISO week-numbering year of the given date.
5 *
6 * @description
7 * Get the ISO week-numbering year of the given date,
8 * which always starts 3 days before the year's first Thursday.
9 *
10 * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
11 *
12 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
13 *
14 * @param date - The given date
15 *
16 * @returns The ISO week-numbering year
17 *
18 * @example
19 * // Which ISO-week numbering year is 2 January 2005?
20 * const result = getISOWeekYear(new Date(2005, 0, 2))
21 * //=> 2004
22 */
23export declare function getISOWeekYear<DateType extends Date>(
24 date: DateType | number | string,
25): number;