30 seconds of code

  Back to Home

minDate

datemathbeginner

Returns the minimum of the given dates.

Use the ES6 spread syntax to find the minimum date value, new Date() to convert it to a Date object.

const minDate = dates => new Date(Math.min(...dates));