Fix selection in calendar
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user