UNPKG

1.12 kBTypeScriptView Raw
1/**
2 * @name isSameISOWeek
3 * @category ISO Week Helpers
4 * @summary Are the given dates in the same ISO week (and year)?
5 *
6 * @description
7 * Are the given dates in the same ISO week (and year)?
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 dateLeft - The first date to check
14 * @param dateRight - The second date to check
15 *
16 * @returns The dates are in the same ISO week (and year)
17 *
18 * @example
19 * // Are 1 September 2014 and 7 September 2014 in the same ISO week?
20 * const result = isSameISOWeek(new Date(2014, 8, 1), new Date(2014, 8, 7))
21 * //=> true
22 *
23 * @example
24 * // Are 1 September 2014 and 1 September 2015 in the same ISO week?
25 * const result = isSameISOWeek(new Date(2014, 8, 1), new Date(2015, 8, 1))
26 * //=> false
27 */
28export declare function isSameISOWeek<DateType extends Date>(
29 dateLeft: DateType | number | string,
30 dateRight: DateType | number | string,
31): boolean;