In my components template I have following code:
<div
class="program-point-container"
v-for="p in programPoints"
:key="p.id"
>
<div class="mt-6 mt-sm-3 mt-md-14 mb-3 font-weight-bold font-size-16" v-if="showDate(p.startsAt)">
{{new Date(p.startsAt) | moment('DD.MM.YYYY')}} // Humboldt Carré
</div>
</div>
My programPoints Array has 23 object´s in it. For debug reasons I console logged a string to see that the function is called 23 * 2 times.
In this method I push data into an array. And return true or false to show the div container. But since it already pushed and returned at the "first" rendering. I don't get to show that container.
showDate(datetime) {
const date = new Date(datetime).toDateString()
// check if date already been pushed
if(this.dates.includes(date)) {
console.log('false')
return false // date already been pushed
}
this.dates.push(date)
console.log('true')
return true
},