1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-27 10:07:10 +00:00
Lidarr/UI/Shared/FormatHelpers.js

38 lines
972 B
JavaScript
Raw Normal View History

2013-06-07 02:39:12 +00:00
"use strict";
define(['app'], function () {
NzbDrone.Shared.FormatHelpers.FileSizeHelper = function (sourceSize) {
var size = Number(sourceSize);
2013-06-07 14:34:54 +00:00
return size.bytes(1);
2013-06-07 02:39:12 +00:00
};
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}');
};
2013-06-21 01:43:58 +00:00
return NzbDrone.Shared.FormatHelpers;
2013-06-07 14:34:54 +00:00
});