Mon Apr 04 2022 10:53:29 GMT+0000 (Coordinated Universal Time)
Saved by @massa
const maxDate = (...dates) => new Date(Math.max.apply(null, ...dates)); const array = [ new Date(2022, 1, 15), new Date(2021, 8, 5), new Date(2022, 8, 22), new Date(2019, 3, 31) ]; maxDate(array); // 2022-08-22T00:00:00.000Z
Copy this HTML code:
Preview:
open_in_newInstructions on embedding in Medium
Comments