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
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