mirror of https://github.com/lidarr/Lidarr
New: Show time instead of date if event occurs/occurred today
Closes #808
This commit is contained in:
parent
0b219e1169
commit
9ffa28f17c
|
@ -12,15 +12,20 @@ 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 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;
|
||||||
|
|
||||||
|
if (diff > 0 && diff < 1) {
|
||||||
|
text = date.format(UiSettings.time(true, false));
|
||||||
|
} else {
|
||||||
if (UiSettings.get('showRelativeDates')) {
|
if (UiSettings.get('showRelativeDates')) {
|
||||||
text = FormatHelpers.relativeDate(dateStr);
|
text = FormatHelpers.relativeDate(dateStr);
|
||||||
} else {
|
} else {
|
||||||
text = date.format(UiSettings.get('shortDateFormat'));
|
text = date.format(UiSettings.get('shortDateFormat'));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.$el.html(result.format(tooltip, text));
|
this.$el.html(result.format(tooltip, text));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#logs-screen {
|
#logs-screen {
|
||||||
|
|
||||||
.log-time-cell{
|
.log-time-cell{
|
||||||
width: 80px;
|
width: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.log-level-cell{
|
.log-level-cell{
|
||||||
|
|
Loading…
Reference in New Issue