From ec75c7ecdb2575642114b236b4631e6e7903c0e1 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Fri, 30 Jan 2026 14:41:02 +0100 Subject: [PATCH] Improve date handling in CalendarView: Add comments to clarify the logic for setting the date to the first of the month to prevent overflow issues when navigating between months. This enhancement aids in maintaining accurate date transitions in the calendar view. --- frontend/src/views/personal/CalendarView.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/src/views/personal/CalendarView.vue b/frontend/src/views/personal/CalendarView.vue index 6300508..3200ac7 100644 --- a/frontend/src/views/personal/CalendarView.vue +++ b/frontend/src/views/personal/CalendarView.vue @@ -467,6 +467,8 @@ export default { const newDate = new Date(this.currentDate); switch (this.currentView) { case 'month': + // Set day to 1 first to avoid month overflow (e.g., Jan 31 - 1 month = Dec 31, not Dec 1) + newDate.setDate(1); newDate.setMonth(newDate.getMonth() - 1); break; case 'week': @@ -483,6 +485,8 @@ export default { const newDate = new Date(this.currentDate); switch (this.currentView) { case 'month': + // Set day to 1 first to avoid month overflow (e.g., Jan 30 + 1 month would skip Feb) + newDate.setDate(1); newDate.setMonth(newDate.getMonth() + 1); break; case 'week':