UNPKG

1.02 kBTypeScriptView Raw
1/**
2 * @name isSameMonth
3 * @category Month Helpers
4 * @summary Are the given dates in the same month (and year)?
5 *
6 * @description
7 * Are the given dates in the same month (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 month (and year)
15 *
16 * @example
17 * // Are 2 September 2014 and 25 September 2014 in the same month?
18 * const result = isSameMonth(new Date(2014, 8, 2), new Date(2014, 8, 25))
19 * //=> true
20 *
21 * @example
22 * // Are 2 September 2014 and 25 September 2015 in the same month?
23 * const result = isSameMonth(new Date(2014, 8, 2), new Date(2015, 8, 25))
24 * //=> false
25 */
26export declare function isSameMonth<DateType extends Date>(
27 dateLeft: DateType | number | string,
28 dateRight: DateType | number | string,
29): boolean;