Fix selection in calendar

This commit is contained in:
2026-06-14 22:42:28 +02:00
parent cb5517a387
commit 3ca1418d94
3 changed files with 41 additions and 1 deletions
+8 -1
View File
@@ -184,6 +184,13 @@ export function Calendar(): ReactNode {
const defaultLeaveType = getLastLeaveType() ?? 'vacation'
const firstSelectedDate = Array.from(selectedDates).sort()[0]
// Dates to highlight in the grid. While dragging, show a live preview of the
// range under the cursor; otherwise show the committed selection.
const highlightedDates =
isDragging && dragAnchor && dragCurrent
? new Set(datesInRange(dragAnchor, dragCurrent))
: selectedDates
return (
<Layout>
<div data-testid="calendar" className="calendar">
@@ -215,7 +222,7 @@ export function Calendar(): ReactNode {
key={weekIdx}
weekDates={week}
plannedDays={plannedDays ?? []}
selectedDates={selectedDates}
selectedDates={highlightedDates}
parentName={parentName ?? 'Du'}
personalDataUuid={personalDataUuid ?? ''}
isCurrentMonth={weekMonth === month}