Skip to content
This repository was archived by the owner on Apr 17, 2022. It is now read-only.

Commit 487ba29

Browse files
committed
refactor: Add validation case for preset ranges
1 parent db3a07f commit 487ba29

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Vue3DatePicker/components/composition/calendar.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -698,9 +698,11 @@ export const useCalendar = (props: UseCalendar, emit: VueEmit): IUseCalendar =>
698698
};
699699

700700
const presetDateRange = (dates: Date[] | string[]): void => {
701-
modelValue.value = dates.map((date) => new Date(date));
702-
if (props.autoApply) {
703-
emit('selectDate');
701+
if (dates.length && dates.length <= 2 && props.range) {
702+
modelValue.value = dates.map((date) => new Date(date));
703+
if (props.autoApply) {
704+
emit('selectDate');
705+
}
704706
}
705707
};
706708

0 commit comments

Comments
 (0)