fix: simplify the maxDate function implementation

This commit is contained in:
Christian C. Salvado
2019-06-12 11:15:54 -06:00
parent 5366d536da
commit c19d3a8506

View File

@ -2,10 +2,10 @@
Returns the maximum of the given dates.
Use `Math.max.apply()` to find the maximum date value, `new Date()` to convert it to a `Date` object.
Use the ES6 spread syntax with `Math.max` to find the maximum date value, `new Date()` to convert it to a `Date` object.
```js
const maxDate = (...dates) => new Date(Math.max.apply(null, ...dates));
const maxDate = dates => new Date(Math.max(...dates));
```
```js