I have an array of objects as shown below :
this.filteredData = [
{'id': 1, 'date': '04-05-2018'},
{'id': 2, 'date': '29-03-2018'},
{'id': 3, 'date': '03-04-2018'},
{'id': 4, 'date': '24-07-2018'},
{'id': 5, 'date': '19-08-2018'},
{'id': 6, 'date': '13-09-2018'},
]
and am trying to sort the array based on the date
on click of the button
this.filteredData.sort(function(a, b){
return new Date(b.date) - new Date(a.date);
});
but the array is not sorting..
Where am i doing wrong? need help