From 6dbd0caf2bc538fb2324d7735e89dcb02184468a Mon Sep 17 00:00:00 2001 From: Ethan Date: Sun, 16 Jan 2022 16:34:32 +0800 Subject: [PATCH] fix(Calendar): incorrectly selected when a date is disabled (#10196) --- packages/vant/src/calendar/Calendar.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/vant/src/calendar/Calendar.tsx b/packages/vant/src/calendar/Calendar.tsx index 13e8f854d..82770ee24 100644 --- a/packages/vant/src/calendar/Calendar.tsx +++ b/packages/vant/src/calendar/Calendar.tsx @@ -406,7 +406,11 @@ export default defineComponent({ ); if (disabledDay) { - select([startDay, getPrevDay(disabledDay)]); + if(startDay.getTime() >= getPrevDay(disabledDay).getTime()) { + select([date]); + }else { + select([startDay, getPrevDay(disabledDay)]); + } } else { select([startDay, date], true); }