This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Zaimki/components/CalendarMonthEvents.vue

31 lines
895 B
Vue
Raw Normal View History

2021-08-18 11:19:24 -07:00
<template>
<ul class="list-unstyled mb-0">
2021-08-19 08:33:48 -07:00
<CalendarEvent v-for="event in events" :event="event" :range="year" :key="event.name"/>
2021-08-18 11:19:24 -07:00
</ul>
</template>
<script>
import { iterateMonth } from '../src/calendar/helpers';
import { currentYear } from '../src/calendar/calendar';
export default {
props: {
year: { required: true },
month: { required: true },
},
computed: {
events() {
let events = [];
for (let day of iterateMonth(this.year, this.month)) {
for (let event of currentYear.eventsByDate[day.toString()] || []) {
if (event.isFirstDay(day)) {
events.push(event);
}
}
}
return events;
}
}
}
</script>