I have this array:
DatosFechas = ["2020-04-29", "2020-04-19", "2020-04-07", "2020-04-30", "2020-04-30", "2018-01-22"]
And I would like to get the oldest or the newest date from a given range.
Ths function that trying to get work:
function ObtenerMaxMinRangoFechas(DatosFechas) {
let moments = DatosFechas.map(x => moment(x)),
maxDate = moment.max(moments)
return maxDate
}
Thx
My date array is longer, just for the purpose of this posting it´s reduced.
This is the error:
Is not giving me the maxdate.