feat: Show if an event is in the past

This commit is contained in:
Norbert Szulc 2024-07-07 20:17:02 +02:00 committed by lesion
parent 6452e46e57
commit e3a6f1b5f5
No known key found for this signature in database
GPG key ID: 352918250B012177

View file

@ -25,6 +25,7 @@
<span itemprop='name'>{{ event.place.name }}</span>
</nuxt-link>
<div class='d-none' itemprop='address'>{{ event.place.address }}</div>
<div class='d-block' v-if="isPast">This event is in the past.</div>
</v-card-text>
@ -51,6 +52,17 @@ export default {
event: { type: Object, default: () => ({}) },
lazy: Boolean
},
computed: mapGetters(['hide_thumbs'])
computed: {
...mapGetters(['hide_thumbs']),
isPast() {
const now = new Date();
console.log(now, this.event.start_datetime)
if (this.event.end_datetime) {
return new Date(this.event.end_datetime*1000) < now;
} else {
return new Date(this.event.start_datetime*1000) < now;
}
}
}
}
</script>