default to the selected month for selectedDay

This commit is contained in:
Josh Hawkins 2024-07-06 21:15:52 -05:00
parent 5cd4720ef2
commit 6cb90e2ebe

View File

@ -61,6 +61,7 @@ export default function ReviewActivityCalendar({
return ( return (
<Calendar <Calendar
key={selectedDay ? selectedDay.toISOString() : "reset"}
mode="single" mode="single"
disabled={disabledDates} disabled={disabledDates}
showOutsideDays={false} showOutsideDays={false}
@ -70,6 +71,7 @@ export default function ReviewActivityCalendar({
components={{ components={{
DayContent: ReviewActivityDay, DayContent: ReviewActivityDay,
}} }}
defaultMonth={selectedDay ?? new Date()}
/> />
); );
} }
@ -152,12 +154,14 @@ export function TimezoneAwareCalendar({
return ( return (
<Calendar <Calendar
key={selectedDay ? selectedDay.toISOString() : "reset"}
mode="single" mode="single"
disabled={disabledDates} disabled={disabledDates}
showOutsideDays={false} showOutsideDays={false}
today={today} today={today}
selected={selectedDay} selected={selectedDay}
onSelect={onSelect} onSelect={onSelect}
defaultMonth={selectedDay ?? new Date()}
/> />
); );
} }