diff --git a/src/UI/Calendar/UpcomingItemViewTemplate.hbs b/src/UI/Calendar/UpcomingItemViewTemplate.hbs index 7c42fdfe2..dd29530f6 100644 --- a/src/UI/Calendar/UpcomingItemViewTemplate.hbs +++ b/src/UI/Calendar/UpcomingItemViewTemplate.hbs @@ -8,7 +8,7 @@

{{title}}

{{/with}} -

{{StartTime airDateUtc}} {{ShortDate airDateUtc}}

+

{{StartTime airDateUtc}} {{#unless_today airDateUtc}}{{ShortDate airDateUtc}}{{/unless_today}}

{{title}} diff --git a/src/UI/Handlebars/Helpers/DateTime.js b/src/UI/Handlebars/Helpers/DateTime.js index 8033a4d88..b784dced3 100644 --- a/src/UI/Handlebars/Helpers/DateTime.js +++ b/src/UI/Handlebars/Helpers/DateTime.js @@ -71,4 +71,28 @@ define( return moment(input).format('h:mm:ss A'); }); + + Handlebars.registerHelper('if_today', function(context, options) { + var date = moment(context).startOf('day'); + var today = moment().startOf('day'); + + + if (date.isSame(today)) { + return options.fn(this); + } + + return options.inverse(this); + }); + + Handlebars.registerHelper('unless_today', function(context, options) { + var date = moment(context).startOf('day'); + var today = moment().startOf('day'); + + + if (date.isSame(today)) { + return options.inverse(this); + } + + return options.fn(this); + }); });