1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-30 19:45:57 +00:00
Lidarr/UI/Shared/FormatHelpers.js
kay.one 769331d45d updated jshint to 2.1.3
single quotes
2013-06-21 23:24:24 -07:00

37 lines
972 B
JavaScript

'use strict';
define(['app'], function () {
NzbDrone.Shared.FormatHelpers.FileSizeHelper = function (sourceSize) {
var size = Number(sourceSize);
return size.bytes(1);
};
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}');
};
return NzbDrone.Shared.FormatHelpers;
});