1const activities = [
2 { title: 'Hiking', date: new Date('2019-06-28') },
3 { title: 'Shopping', date: new Date('2019-06-10') },
4 { title: 'Trekking', date: new Date('2019-06-22') }
5]
6
1array.sort(function(o1,o2){
2 if (sort_o1_before_o2) return -1;
3 else if(sort_o1_after_o2) return 1;
4 else return 0;
5});
1 arr = arr.sort(function (a, b) {
2 var dateA = new Date(a.date_prop).getTime();
3 var dateB = new Date(b.date_prop).getTime();
4 return dateA < dateB ? 1 : -1;
5 });
6