function compareEpisodesByDate (a, b) { var dateA = new Date(a.start) var dateB = new Date(b.start) if (dateA < dateB) { return -1 } else if (dateA > dateB) { return 1 } else { return 0 } } export default { computed: { timeslotsPast: function () { var eps = [] var now = new Date() for (var x in this.timeslotsSortedDate) { if (new Date(this.timeslots[x].start) < now) { eps.push(this.timeslots[x]) } } return eps }, timeslotsFuture: function () { var eps = [] var now = new Date() for (var x in this.timeslotsSortedDate) { if (new Date(this.timeslots[x].start) >= now) { eps.push(this.timeslots[x]) } } return eps }, timeslotsSortedDate: function () { return this.timeslots.sort(compareEpisodesByDate) } } }