UNPKG

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