From c24eb3205b07c3935aaff9876394924d29381f25 Mon Sep 17 00:00:00 2001 From: les Date: Mon, 8 Mar 2021 14:38:47 +0100 Subject: [PATCH] Show events until end of month --- components/Calendar.vue | 18 +++++++++--------- pages/index.vue | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/components/Calendar.vue b/components/Calendar.vue index 59eb331d..aaa643e1 100644 --- a/components/Calendar.vue +++ b/components/Calendar.vue @@ -27,14 +27,12 @@ export default { const month = dayjs().month() + 1 const year = dayjs().year() return { - page: { month, year }, - attributes: [] + page: { month, year } } }, - computed: mapState(['tags', 'filters', 'in_past', 'settings']), - methods: { - ...mapActions(['updateEvents', 'showPastEvents']), - updateAttributes () { + computed: { + ...mapState(['tags', 'filters', 'in_past', 'settings']), + attributes () { const colors = ['blue', 'orange', 'yellow', 'teal', 'indigo', 'green', 'red', 'purple', 'pink', 'gray'] const tags = take(this.tags, 10).map(t => t.tag) let attributes = [] @@ -68,12 +66,14 @@ export default { dates: { start: new Date(e.start_datetime * 1000), end: new Date(e.end_datetime * 1000) } }))) - this.attributes = attributes - }, + return attributes + } + }, + methods: { + ...mapActions(['updateEvents', 'showPastEvents']), updatePage (page) { return new Promise((resolve, reject) => { this.$emit('monthchange', page) - this.updateAttributes() }) }, click (day) { diff --git a/pages/index.vue b/pages/index.vue index 0ed2f8da..2bc49196 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -126,8 +126,8 @@ export default { this.date = '' this.start = dayjs().year(year).month(month - 1).startOf('month').unix() // .startOf('week').unix() } - // this.end = dayjs().year(year).month(month - 1).endOf('month').unix() // .endOf('week').unix() - this.end = null + // TODO: check if calendar view is double + this.end = dayjs().year(year).month(month).endOf('month').unix() // .endOf('week').unix() this.updateEvents() }, dayChange (day) {