Skip to content

Commit

Permalink
fix: not allowing to select other year
Browse files Browse the repository at this point in the history
  • Loading branch information
khareemnurulla committed Aug 7, 2024
1 parent c47d3a8 commit 6b4ef99
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/ui/src/components/Datepicker/Views/Months.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface DatepickerViewsMonthsProps {
}

export const DatepickerViewsMonth: FC<DatepickerViewsMonthsProps> = ({ theme: customTheme = {} }) => {
const { theme: rootTheme, minDate, maxDate, selectedDate, language, setViewDate, setView } = useDatePickerContext();
const { theme: rootTheme, minDate, maxDate, selectedDate, viewDate, language, setViewDate, setView } = useDatePickerContext();

const theme = mergeDeep(rootTheme.views.months, customTheme);

Expand All @@ -30,6 +30,7 @@ export const DatepickerViewsMonth: FC<DatepickerViewsMonthsProps> = ({ theme: cu
const newDate = new Date();
// setting day to 1 to avoid overflow issues
newDate.setMonth(index, 1);
newDate.setFullYear(viewDate.getFullYear());
const month = getFormattedDate(language, newDate, { month: "short" });

const isSelected = isMonthEqual(selectedDate, newDate);
Expand Down

0 comments on commit 6b4ef99

Please sign in to comment.