Im try to get the min and max date from an array in Javascript but I'm getting this error NaN
here the little code:
var dates = [];
var fecha1 = "2020-05-05 15:00:00";
var fecha2 = "2020-05-05 16:00:00";
var fecha3 = "2020-05-06 13:00:00";
dates.push(fecha1);
dates.push(fecha2);
dates.push(fecha3);
console.log(dates);
var maximumDate=Math.max.apply(null, dates);
var minimumDate=new Date(Math.min.apply(null, dates));
console.log(maximumDate);
I hope i explained well