Skip to content

Commit

Permalink
Merge pull request #361 from nypublicradio/mwalsh/hotfix-missing-star…
Browse files Browse the repository at this point in the history
…ttime

Don't show "Invalid Time" when start time is invalid or missing
  • Loading branch information
walsh9 authored Sep 30, 2024
2 parents 817b858 + 1e82e6d commit 0d852fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/components/centennial/event-card/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export default Component.extend({
return moment(this.get('event.attributes.startDate')).format('DD');
}),
startTime: computed('event.attributes.{startDate,startTime}', function() {
return moment(`${this.get('event.attributes.startDate')} ${this.get('event.attributes.startTime')}`).format('h:mm A');
const startTime = moment(`${this.get('event.attributes.startDate')} ${this.get('event.attributes.startTime')}`)
if (startTime.isValid()) {
return startTime.format('h:mm A');
}
}),
tags: computed('event.attributes.tags', function() {
return this.get('event.attributes.tags').split(', ');
Expand Down
2 changes: 2 additions & 0 deletions app/components/centennial/event-card/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
</div>
<div class="event-card__details">
<h3 class="event-card__title"><a href={{eventUrl}}>{{event.attributes.title}}</a></h3>
{{#if startTime}}
<div class="event-card__time">{{startTime}}</div>
{{/if}}
<div class="event-card__tags">
{{#if isLiveStream}}
<span class="event-card__tag mod-live-stream">Live Stream</span>
Expand Down

0 comments on commit 0d852fd

Please sign in to comment.