I have this function that returns me an array of date objects.
function get_location_dates(filter){
return filter.map(function(){
var [day, month, year] = $(this).text().split('-');
return new Date(parseInt(year), parseInt(month)-1, parseInt(day));
}).get();
}
$('#dropoff-locations .date:first').text();
"25-09-2019"
var dropoff = $('#dropoff-locations .date');
undefined
get_location_dates(dropoff);
(2) [Wed Sep 25 2019 00:00:00 GMT+0300 (East Africa Time), Tue Sep 24 2019 00:00:00 GMT+0300 (East Africa Time)]
I now need to sort them from the earliest date to the oldest/latest date. The suggested question doesn't quite apply to these scenario since unlike a list with an array containing a date, this is purely an array of dates.
How do I do that?