I am having trouble trying to make these datetimes in array
sortable. How is this solved?
var array = [{id: 1, date: '16-04-2021 14:24:14'}, {id: 2, date: '16-04-2021 14:24:15'}];
const sortedArray = array.sort(function(a,b){
// Returns = null
console.warn(new Date(b.date))
return new Date(b.date) - new Date(a.date);
});