UNPKG

779 BTypeScriptView Raw
1/**
2 * @name min
3 * @category Common Helpers
4 * @summary Returns the earliest of the given dates.
5 *
6 * @description
7 * Returns the earliest 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 earliest of the dates
14 *
15 * @example
16 * // Which of these dates is the earliest?
17 * const result = min([
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 * //=> Wed Feb 11 1987 00:00:00
24 */
25export declare function min<DateType extends Date>(
26 dates: Array<DateType | number | string>,
27): DateType | Date;