UNPKG

997 BTypeScriptView Raw
1/**
2 * @name setISOWeekYear
3 * @category ISO Week-Numbering Year Helpers
4 * @summary Set the ISO week-numbering year to the given date.
5 *
6 * @description
7 * Set the ISO week-numbering year to the given date,
8 * saving the week number and the weekday number.
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 date to be changed
15 * @param weekYear - The ISO week-numbering year of the new date
16 *
17 * @returns The new date with the ISO week-numbering year set
18 *
19 * @example
20 * // Set ISO week-numbering year 2007 to 29 December 2008:
21 * const result = setISOWeekYear(new Date(2008, 11, 29), 2007)
22 * //=> Mon Jan 01 2007 00:00:00
23 */
24export declare function setISOWeekYear<DateType extends Date>(
25 date: DateType | number | string,
26 weekYear: number,
27): DateType;