mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-15 01:23:53 -07:00
Moved source code under src folder - massive change
This commit is contained in:
parent
2fc8123d6b
commit
5bf0e197ec
1499 changed files with 1054 additions and 1444 deletions
58
src/UI/Handlebars/Helpers/DateTime.js
Normal file
58
src/UI/Handlebars/Helpers/DateTime.js
Normal file
|
@ -0,0 +1,58 @@
|
|||
'use strict';
|
||||
define(
|
||||
[
|
||||
'handlebars',
|
||||
'moment',
|
||||
'Shared/FormatHelpers'
|
||||
], function (Handlebars, Moment, FormatHelpers) {
|
||||
Handlebars.registerHelper('ShortDate', function (input) {
|
||||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var date = Moment(input);
|
||||
var result = '<span title="' + date.format('LLLL') + '">' + date.format('LL') + '</span>';
|
||||
|
||||
return new Handlebars.SafeString(result);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('NextAiring', function (input) {
|
||||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var date = Moment(input);
|
||||
var result = '<span title="' + date.format('LLLL') + '">' + FormatHelpers.dateHelper(input) + '</span>';
|
||||
|
||||
return new Handlebars.SafeString(result);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('Day', function (input) {
|
||||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return Moment(input).format('DD');
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('Month', function (input) {
|
||||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return Moment(input).format('MMM');
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('StartTime', function (input) {
|
||||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var date = Moment(input);
|
||||
if (date.format('mm') === '00') {
|
||||
return date.format('ha');
|
||||
}
|
||||
|
||||
return date.format('h.mma');
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue