mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
Helper cleanup
This commit is contained in:
parent
1fb944976e
commit
626d48c8ea
16 changed files with 89 additions and 83 deletions
36
UI/Shared/FormatHelpers.js
Normal file
36
UI/Shared/FormatHelpers.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
"use strict";
|
||||
|
||||
define(['app'], function () {
|
||||
NzbDrone.Shared.FormatHelpers.FileSizeHelper = function (sourceSize) {
|
||||
var size = Number(sourceSize);
|
||||
this.$el.html(size.bytes(1));
|
||||
return this;
|
||||
};
|
||||
|
||||
NzbDrone.Shared.FormatHelpers.DateHelper = function (sourceDate) {
|
||||
if (!sourceDate) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var date = Date.create(sourceDate);
|
||||
|
||||
if (date.isYesterday()) {
|
||||
return 'Yesterday';
|
||||
}
|
||||
if (date.isToday()) {
|
||||
return 'Today';
|
||||
}
|
||||
if (date.isTomorrow()) {
|
||||
return 'Tomorrow';
|
||||
}
|
||||
if (date.isAfter(Date.create('tomorrow')) && date.isBefore(Date.create().addDays(7))) {
|
||||
return date.format('{Weekday}');
|
||||
}
|
||||
|
||||
if (date.isAfter(Date.create().addDays(6))) {
|
||||
return date.relative().replace(' from now', '');
|
||||
}
|
||||
|
||||
return date.format('{MM}/{dd}/{yyyy}');
|
||||
};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue