From f50c46297875bc65f99275e10e12a86044eff46f Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 16 Jan 2022 16:45:24 +0800 Subject: [PATCH] chore(Calendar): using compareDay util (#10198) --- packages/vant/src/calendar/Calendar.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/vant/src/calendar/Calendar.tsx b/packages/vant/src/calendar/Calendar.tsx index 82770ee24..55d2970f3 100644 --- a/packages/vant/src/calendar/Calendar.tsx +++ b/packages/vant/src/calendar/Calendar.tsx @@ -406,10 +406,11 @@ export default defineComponent({ ); if (disabledDay) { - if(startDay.getTime() >= getPrevDay(disabledDay).getTime()) { + const endDay = getPrevDay(disabledDay); + if (compareDay(startDay, endDay) === -1) { + select([startDay, endDay]); + } else { select([date]); - }else { - select([startDay, getPrevDay(disabledDay)]); } } else { select([startDay, date], true);