Skip to content
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