Skip to content

1531: Fix/DatePicker month view error: selected month not highlighted #1574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/ui/src/components/Datepicker/Views/Months.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ export function DatepickerViewsMonth() {
<div className={theme.items.base}>
{[...Array(12)].map((_month, index) => {
const newDate = new Date();
// setting day to 1 to avoid overflow issues
newDate.setMonth(index, 1);
// if selectedDate is non-null, align days to accurately detect if month is selected
// else if selectedDate is null, set day to 1 to avoid overflow
newDate.setMonth(index, selectedDate ? selectedDate.getDate() : 1);
newDate.setFullYear(viewDate.getFullYear());
const month = getFormattedDate(language, newDate, { month: "short" });

Expand Down
Loading