parent
0b219e1169
commit
9ffa28f17c
@ -1,13 +1,30 @@
|
|||||||
var NzbDroneCell = require('../../../Cells/NzbDroneCell');
|
var NzbDroneCell = require('../../../Cells/NzbDroneCell');
|
||||||
var moment = require('moment');
|
var moment = require('moment');
|
||||||
|
var FormatHelpers = require('../../../Shared/FormatHelpers');
|
||||||
var UiSettings = require('../../../Shared/UiSettingsModel');
|
var UiSettings = require('../../../Shared/UiSettingsModel');
|
||||||
|
|
||||||
module.exports = NzbDroneCell.extend({
|
module.exports = NzbDroneCell.extend({
|
||||||
className : 'log-time-cell',
|
className : 'log-time-cell',
|
||||||
|
|
||||||
render : function() {
|
render : function() {
|
||||||
var date = moment(this._getValue());
|
var dateStr = this._getValue();
|
||||||
this.$el.html('<span title="{1}">{0}</span>'.format(date.format(UiSettings.time(true, false)), date.format(UiSettings.longDateTime(true))));
|
var date = moment(dateStr);
|
||||||
|
var diff = date.diff(moment().zone(date.zone()).startOf('day'), 'days', true);
|
||||||
|
var result = '<span title="{0}">{1}</span>';
|
||||||
|
var tooltip = date.format(UiSettings.longDateTime(true));
|
||||||
|
var text;
|
||||||
|
|
||||||
|
if (diff > 0 && diff < 1) {
|
||||||
|
text = date.format(UiSettings.time(true, false));
|
||||||
|
} else {
|
||||||
|
if (UiSettings.get('showRelativeDates')) {
|
||||||
|
text = FormatHelpers.relativeDate(dateStr);
|
||||||
|
} else {
|
||||||
|
text = date.format(UiSettings.get('shortDateFormat'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$el.html(result.format(tooltip, text));
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue