Only show date in upcoming when its not an episode for today

pull/6/head
Mark McDowall 10 years ago
parent ab868cc403
commit bf62ab0d26

@ -8,7 +8,7 @@
<h4>{{title}}</h4> <h4>{{title}}</h4>
</a> </a>
{{/with}} {{/with}}
<p>{{StartTime airDateUtc}} {{ShortDate airDateUtc}}</p> <p>{{StartTime airDateUtc}} {{#unless_today airDateUtc}}{{ShortDate airDateUtc}}{{/unless_today}}</p>
<p> <p>
<span class="episode-title x-episode-title"> <span class="episode-title x-episode-title">
{{title}} {{title}}

@ -71,4 +71,28 @@ define(
return moment(input).format('h:mm:ss A'); 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);
});
}); });

Loading…
Cancel
Save