fix: simplify the maxDate function implementation
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user