1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-26 17:59:14 +00:00
Radarr/UI/Calendar/UpcomingCollection.js

33 lines
855 B
JavaScript
Raw Normal View History

'use strict';
define(
[
'backbone',
'moment',
'Series/EpisodeModel'
], function (Backbone, Moment, EpisodeModel) {
return Backbone.Collection.extend({
url : window.ApiRoot + '/calendar',
model: EpisodeModel,
comparator: function (model1, model2) {
2013-07-24 05:28:06 +00:00
var airDate1 = model1.get('airDateUtc');
var date1 = Moment(airDate1);
var time1 = date1.unix();
2013-07-24 05:28:06 +00:00
var airDate2 = model2.get('airDateUtc');
var date2 = Moment(airDate2);
var time2 = date2.unix();
if (time1 < time2){
return -1;
}
if (time1 > time2){
return 1;
}
return 0;
}
});
});