Return the latest of the given dates.
Return the latest of the given dates.
// CommonJS
var max = require('date-fns/max')
// ES 2015 import max from 'date-fns/max'
// ESM
import { max } from 'date-fns'
max(datesArray)
| Name | Description |
|---|---|
datesArray |
the dates to compare |
| Description |
|---|
|
the latest of the dates |
| Type | Description |
|---|---|
TypeError |
1 argument required |
// Which of these dates is the latest? const result = max([ new Date(1989, 6, 10), new Date(1987, 1, 11), new Date(1995, 6, 2), new Date(1990, 0, 1) ]) //=> Sun Jul 02 1995 00:00:00
© 2021 Sasha Koss and Lesha Koss
Licensed under the MIT License.
https://date-fns.org/v2.29.2/docs/max