New: Show time instead of date if event occurs/occurred today

Closes #808
pull/721/head
Mark McDowall 9 years ago
parent 0b219e1169
commit 9ffa28f17c

@ -12,14 +12,19 @@ module.exports = NzbDroneCell.extend({
if (dateStr) {
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());
var text;
if (UiSettings.get('showRelativeDates')) {
text = FormatHelpers.relativeDate(dateStr);
if (diff > 0 && diff < 1) {
text = date.format(UiSettings.time(true, false));
} else {
text = date.format(UiSettings.get('shortDateFormat'));
if (UiSettings.get('showRelativeDates')) {
text = FormatHelpers.relativeDate(dateStr);
} else {
text = date.format(UiSettings.get('shortDateFormat'));
}
}
this.$el.html(result.format(tooltip, text));

@ -10,7 +10,7 @@ module.exports = {
if (isNaN(size)) {
return '';
}
if (isNaN(rounding)) {
rounding = 1;
}

@ -1,13 +1,30 @@
var NzbDroneCell = require('../../../Cells/NzbDroneCell');
var moment = require('moment');
var FormatHelpers = require('../../../Shared/FormatHelpers');
var UiSettings = require('../../../Shared/UiSettingsModel');
module.exports = NzbDroneCell.extend({
className : 'log-time-cell',
render : function() {
var date = moment(this._getValue());
this.$el.html('<span title="{1}">{0}</span>'.format(date.format(UiSettings.time(true, false)), date.format(UiSettings.longDateTime(true))));
var dateStr = this._getValue();
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;
}

@ -3,7 +3,7 @@
#logs-screen {
.log-time-cell{
width: 80px;
width: 100px;
}
.log-level-cell{

Loading…
Cancel
Save