From 3da1cab2c87461f0bde81ccb0dea363eb9fc7548 Mon Sep 17 00:00:00 2001 From: tristan Date: Tue, 19 May 2026 14:04:45 +0200 Subject: [PATCH] fix(leave) : clip leave-tab absence fetch to selected phase bounds The annual calendar in LeaveTab.vue was showing absences from outside the selected phase's lifespan. For an employee who switched contract type mid-year, this leaked the old phase's absences into the new phase's calendar view (and vice versa via the phase picker). Co-Authored-By: Claude Opus 4.7 (1M context) --- frontend/composables/useEmployeeLeave.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/composables/useEmployeeLeave.ts b/frontend/composables/useEmployeeLeave.ts index 53d721f..d19ea5d 100644 --- a/frontend/composables/useEmployeeLeave.ts +++ b/frontend/composables/useEmployeeLeave.ts @@ -91,8 +91,11 @@ export const useEmployeeLeave = ( try { const isForfait = isForfaitOnPhase.value const leaveYear = selectedLeaveYear.value - const from = isForfait ? `${leaveYear}-01-01` : `${leaveYear - 1}-06-01` - const to = isForfait ? `${leaveYear}-12-31` : `${leaveYear}-05-31` + let from = isForfait ? `${leaveYear}-01-01` : `${leaveYear - 1}-06-01` + let to = isForfait ? `${leaveYear}-12-31` : `${leaveYear}-05-31` + const phase = selectedPhase.value + if (phase?.startDate && phase.startDate > from) from = phase.startDate + if (phase?.endDate && phase.endDate < to) to = phase.endDate const holidayYears = isForfait ? [leaveYear] : [leaveYear - 1, leaveYear] const [absences, summary, ...holidayResults] = await Promise.all([