UNPKG

840 BTypeScriptView Raw
1/**
2 * @name isBefore
3 * @category Common Helpers
4 * @summary Is the first date before the second one?
5 *
6 * @description
7 * Is the first date before the second one?
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 date - The date that should be before the other one to return true
12 * @param dateToCompare - The date to compare with
13 *
14 * @returns The first date is before the second date
15 *
16 * @example
17 * // Is 10 July 1989 before 11 February 1987?
18 * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
19 * //=> false
20 */
21export declare function isBefore<DateType extends Date>(
22 date: DateType | number | string,
23 dateToCompare: DateType | number | string,
24): boolean;