UNPKG

861 BTypeScriptView Raw
1/**
2 * @name setISOWeek
3 * @category ISO Week Helpers
4 * @summary Set the ISO week to the given date.
5 *
6 * @description
7 * Set the ISO week to the given date, saving the weekday number.
8 *
9 * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
10 *
11 * @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).
12 *
13 * @param date - The date to be changed
14 * @param week - The ISO week of the new date
15 *
16 * @returns The new date with the ISO week set
17 *
18 * @example
19 * // Set the 53rd ISO week to 7 August 2004:
20 * const result = setISOWeek(new Date(2004, 7, 7), 53)
21 * //=> Sat Jan 01 2005 00:00:00
22 */
23export declare function setISOWeek<DateType extends Date>(
24 date: DateType | number | string,
25 week: number,
26): DateType;