diff --git a/src/spdm/views/home/components/ToDoCalendar.vue b/src/spdm/views/home/components/ToDoCalendar.vue index 6a1db5f..8a0e208 100644 --- a/src/spdm/views/home/components/ToDoCalendar.vue +++ b/src/spdm/views/home/components/ToDoCalendar.vue @@ -18,6 +18,11 @@ export default { transparent borderless expanded + :initial-page="{ + month: new Date().getMonth(), + year: new Date().getFullYear(), + week: new Date().getWeek() + 1, + }" @did-move="weeknumberClick" @dayclick="dayClick" /> @@ -74,6 +79,13 @@ const locale = computed(() => { const masks = ref({ weekdays: 'WWW', }); +Date.prototype.getWeek = function () { + const date = new Date(this.getTime()); + date.setHours(0, 0, 0, 0); + date.setDate(date.getDate() + 3 - ((date.getDay() + 6) % 7)); + const week1 = new Date(date.getFullYear(), 0, 4); + return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + ((week1.getDay() + 6) % 7)) / 7); +}; const reminders = ref([]); const calendar = ref(null);