30 seconds of code

  Back to Home

maxDate

datemathbeginner

Returns the maximum of the given dates.

Use the ES6 spread syntax with Math.max to find the maximum date value, new Date() to convert it to a Date object.

const maxDate = dates => new Date(Math.max(...dates));