sort by date

This commit is contained in:
Rob 2019-09-22 12:52:53 +02:00
parent 1d1d3e6761
commit 2120ab8de5
1 changed files with 26 additions and 19 deletions

View File

@ -84,7 +84,6 @@ class Schedule {
getEvents()
{
let allEvents = [];
if (this.events.length == 0 ){
//this.schedule.find('event').toArray();
var now = this.now
this.schedule.find('event').each( function(){
@ -103,7 +102,15 @@ class Schedule {
});
}
});
}
allEvents.sort((a,b) => {
var a_start = new Date(a.date).getTime();
var b_start = new Date(b.date).getTime();
console.log(a_start, b_start, a_start - b_start);
return a_start - b_start;
});
this.events = allEvents;
}