Cleanup moment.js deprecated zone and add functions
This commit is contained in:
parent
15bd181f16
commit
3492d6bbaa
|
@ -151,7 +151,7 @@ module.exports = Marionette.ItemView.extend({
|
||||||
var seriesTitle = model.get('series').title;
|
var seriesTitle = model.get('series').title;
|
||||||
var start = model.get('airDateUtc');
|
var start = model.get('airDateUtc');
|
||||||
var runtime = model.get('series').runtime;
|
var runtime = model.get('series').runtime;
|
||||||
var end = moment(start).add('minutes', runtime).toISOString();
|
var end = moment(start).add(runtime, 'minutes').toISOString();
|
||||||
|
|
||||||
var event = {
|
var event = {
|
||||||
title : seriesTitle,
|
title : seriesTitle,
|
||||||
|
@ -281,4 +281,4 @@ module.exports = Marionette.ItemView.extend({
|
||||||
this.$('.fc-day-grid-container').css('height', '');
|
this.$('.fc-day-grid-container').css('height', '');
|
||||||
this.$('.fc-row.fc-widget-header').attr('style', '');
|
this.$('.fc-row.fc-widget-header').attr('style', '');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,7 +13,7 @@ module.exports = Marionette.ItemView.extend({
|
||||||
initialize : function() {
|
initialize : function() {
|
||||||
var start = this.model.get('airDateUtc');
|
var start = this.model.get('airDateUtc');
|
||||||
var runtime = this.model.get('series').runtime;
|
var runtime = this.model.get('series').runtime;
|
||||||
var end = moment(start).add('minutes', runtime);
|
var end = moment(start).add(runtime, 'minutes');
|
||||||
|
|
||||||
this.model.set({
|
this.model.set({
|
||||||
end : end.toISOString()
|
end : end.toISOString()
|
||||||
|
@ -25,4 +25,4 @@ module.exports = Marionette.ItemView.extend({
|
||||||
_showEpisodeDetails : function() {
|
_showEpisodeDetails : function() {
|
||||||
vent.trigger(vent.Commands.ShowEpisodeDetails, { episode : this.model });
|
vent.trigger(vent.Commands.ShowEpisodeDetails, { episode : this.model });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,7 +12,7 @@ module.exports = NzbDroneCell.extend({
|
||||||
|
|
||||||
if (dateStr) {
|
if (dateStr) {
|
||||||
var date = moment(dateStr);
|
var date = moment(dateStr);
|
||||||
var diff = date.diff(moment().zone(date.zone()).startOf('day'), 'days', true);
|
var diff = date.diff(moment().utcOffset(date.utcOffset()).startOf('day'), 'days', true);
|
||||||
var result = '<span title="{0}">{1}</span>';
|
var result = '<span title="{0}">{1}</span>';
|
||||||
var tooltip = date.format(UiSettings.longDateTime());
|
var tooltip = date.format(UiSettings.longDateTime());
|
||||||
var text;
|
var text;
|
||||||
|
@ -31,4 +31,4 @@ module.exports = NzbDroneCell.extend({
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -20,7 +20,7 @@ var singleton = function() {
|
||||||
var attr = _.extend({ name : name.toLocaleLowerCase() }, properties);
|
var attr = _.extend({ name : name.toLocaleLowerCase() }, properties);
|
||||||
var commandModel = new CommandModel(attr);
|
var commandModel = new CommandModel(attr);
|
||||||
|
|
||||||
if (this._lastCommand.command && this._lastCommand.command.isSameCommand(attr) && moment().add('seconds', -5).isBefore(this._lastCommand.time)) {
|
if (this._lastCommand.command && this._lastCommand.command.isSameCommand(attr) && moment().add(-5, 'seconds').isBefore(this._lastCommand.time)) {
|
||||||
|
|
||||||
Messenger.show({
|
Messenger.show({
|
||||||
message : 'Please wait at least 5 seconds before running this command again',
|
message : 'Please wait at least 5 seconds before running this command again',
|
||||||
|
|
|
@ -214,8 +214,8 @@ module.exports = Marionette.Layout.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_shouldShowEpisodes : function() {
|
_shouldShowEpisodes : function() {
|
||||||
var startDate = moment().add('month', -1);
|
var startDate = moment().add(-1, 'month');
|
||||||
var endDate = moment().add('year', 1);
|
var endDate = moment().add(1, 'year');
|
||||||
|
|
||||||
return this.episodeCollection.some(function(episode) {
|
return this.episodeCollection.some(function(episode) {
|
||||||
var airDate = episode.get('airDateUtc');
|
var airDate = episode.get('airDateUtc');
|
||||||
|
@ -298,4 +298,4 @@ module.exports = Marionette.Layout.extend({
|
||||||
|
|
||||||
vent.trigger(vent.Commands.OpenModalCommand, view);
|
vent.trigger(vent.Commands.OpenModalCommand, view);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -40,7 +40,7 @@ module.exports = {
|
||||||
return 'in ' + date.fromNow(true);
|
return 'in ' + date.fromNow(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (date.isBefore(moment().add('years', -1))) {
|
if (date.isBefore(moment().add(-1, 'years'))) {
|
||||||
return date.format(UiSettings.get('shortDateFormat'));
|
return date.format(UiSettings.get('shortDateFormat'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,4 +68,4 @@ module.exports = {
|
||||||
|
|
||||||
return unit + 's';
|
return unit + 's';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,7 +9,7 @@ module.exports = NzbDroneCell.extend({
|
||||||
render : function() {
|
render : function() {
|
||||||
var dateStr = this._getValue();
|
var dateStr = this._getValue();
|
||||||
var date = moment(dateStr);
|
var date = moment(dateStr);
|
||||||
var diff = date.diff(moment().zone(date.zone()).startOf('day'), 'days', true);
|
var diff = date.diff(moment().utcOffset(date.utcOffset()).startOf('day'), 'days', true);
|
||||||
var result = '<span title="{0}">{1}</span>';
|
var result = '<span title="{0}">{1}</span>';
|
||||||
var tooltip = date.format(UiSettings.longDateTime(true));
|
var tooltip = date.format(UiSettings.longDateTime(true));
|
||||||
var text;
|
var text;
|
||||||
|
@ -28,4 +28,4 @@ module.exports = NzbDroneCell.extend({
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue