Skip to content

Commit b38cb43

Browse files
committed
fix: prevent-min-max-navigation not calculated properly when v-model is provided in month-picker mode (fixes #861)
1 parent 5420d84 commit b38cb43

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/VueDatePicker/components/shared/month-quarter-picker.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { computed, onMounted, ref } from 'vue';
2-
import { addYears, getMonth, getYear, set, subYears } from 'date-fns';
2+
import { addYears, endOfYear, getMonth, getYear, set, startOfYear, subYears } from 'date-fns';
33

44
import { checkHighlightYear, getDate, getMinMaxYear, resetDate, validateMonthYear } from '@/utils/date-utils';
55
import { checkMinMaxValue, getYears, groupListAndMap } from '@/utils/util';
@@ -56,8 +56,9 @@ export const useMonthOrQuarterPicker = ({
5656
month: month.value(instance),
5757
year: year.value(instance),
5858
});
59+
const date = next ? endOfYear(currentDate) : startOfYear(currentDate);
5960
return validateMonthYear(
60-
currentDate,
61+
date,
6162
propDates.value.maxDate,
6263
propDates.value.minDate,
6364
props.preventMinMaxNavigation,

0 commit comments

Comments
 (0)