2013-06-22 08:24:24 +02:00
|
|
|
'use strict';
|
2013-06-21 02:06:56 +02:00
|
|
|
define(
|
|
|
|
[
|
2013-06-25 06:43:16 +02:00
|
|
|
'handlebars',
|
2013-07-17 08:23:44 +02:00
|
|
|
'moment',
|
|
|
|
'Shared/FormatHelpers'
|
|
|
|
], function (Handlebars, Moment, FormatHelpers) {
|
2013-06-25 06:43:16 +02:00
|
|
|
Handlebars.registerHelper('ShortDate', function (input) {
|
|
|
|
if (!input) {
|
|
|
|
return '';
|
|
|
|
}
|
2013-06-21 02:06:56 +02:00
|
|
|
|
2013-07-17 08:23:44 +02:00
|
|
|
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);
|
2013-08-04 03:27:12 +02:00
|
|
|
var result = '<span title="' + date.format('LLLL') + '">' + FormatHelpers.dateHelper(input) + '</span>';
|
2013-06-21 02:06:56 +02:00
|
|
|
|
2013-06-25 06:43:16 +02:00
|
|
|
return new Handlebars.SafeString(result);
|
|
|
|
});
|
2013-07-17 02:41:04 +02:00
|
|
|
|
|
|
|
Handlebars.registerHelper('Day', function (input) {
|
|
|
|
if (!input) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
2013-07-17 08:23:44 +02:00
|
|
|
return Moment(input).format('DD');
|
2013-07-17 02:41:04 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
Handlebars.registerHelper('Month', function (input) {
|
|
|
|
if (!input) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
2013-07-17 08:23:44 +02:00
|
|
|
return Moment(input).format('MMM');
|
2013-07-17 02:41:04 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
Handlebars.registerHelper('StartTime', function (input) {
|
|
|
|
if (!input) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
2013-07-17 08:23:44 +02:00
|
|
|
var date = Moment(input);
|
|
|
|
if (date.format('mm') === '00') {
|
|
|
|
return date.format('ha');
|
2013-07-17 02:41:04 +02:00
|
|
|
}
|
|
|
|
|
2013-07-17 08:23:44 +02:00
|
|
|
return date.format('h.mma');
|
2013-07-17 02:41:04 +02:00
|
|
|
});
|
2013-06-21 02:06:56 +02:00
|
|
|
});
|