UNPKG

769 BTypeScriptView Raw
1/**
2 * @name max
3 * @category Common Helpers
4 * @summary Return the latest of the given dates.
5 *
6 * @description
7 * Return the latest of the given dates.
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 dates - The dates to compare
12 *
13 * @returns The latest of the dates
14 *
15 * @example
16 * // Which of these dates is the latest?
17 * const result = max([
18 * new Date(1989, 6, 10),
19 * new Date(1987, 1, 11),
20 * new Date(1995, 6, 2),
21 * new Date(1990, 0, 1)
22 * ])
23 * //=> Sun Jul 02 1995 00:00:00
24 */
25export declare function max<DateType extends Date>(
26 dates: Array<DateType | number | string>,
27): DateType | Date;