UNPKG

894 BTypeScriptView Raw
1/**
2 * @name differenceInMonths
3 * @category Month Helpers
4 * @summary Get the number of full months between the given dates.
5 *
6 * @description
7 * Get the number of full months between the given dates using trunc as a default rounding method.
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 later date
12 * @param dateRight - The earlier date
13 *
14 * @returns The number of full months
15 *
16 * @example
17 * // How many full months are between 31 January 2014 and 1 September 2014?
18 * const result = differenceInMonths(new Date(2014, 8, 1), new Date(2014, 0, 31))
19 * //=> 7
20 */
21export declare function differenceInMonths<DateType extends Date>(
22 dateLeft: DateType | number | string,
23 dateRight: DateType | number | string,
24): number;