We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2dcc282 commit 3f93293Copy full SHA for 3f93293
packages/ui/src/components/Datepicker/Views/Months.tsx
@@ -33,8 +33,9 @@ export function DatepickerViewsMonth() {
33
<div className={theme.items.base}>
34
{[...Array(12)].map((_month, index) => {
35
const newDate = new Date();
36
- // setting day to 1 to avoid overflow issues
37
- 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
38
+ newDate.setMonth(index, selectedDate ? selectedDate.getDate() : 1);
39
newDate.setFullYear(viewDate.getFullYear());
40
const month = getFormattedDate(language, newDate, { month: "short" });
41
0 commit comments