From c3776877cac678965ed0ba8ba25e18462f945700 Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 13 Aug 2022 11:43:15 +0800 Subject: [PATCH] fix(Calendar): fix reading getFullYear error (#10908) --- packages/vant/src/calendar/Calendar.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/vant/src/calendar/Calendar.tsx b/packages/vant/src/calendar/Calendar.tsx index 5957a7671..325aef8b8 100644 --- a/packages/vant/src/calendar/Calendar.tsx +++ b/packages/vant/src/calendar/Calendar.tsx @@ -299,7 +299,9 @@ export default defineComponent({ props.type === 'single' ? (currentDate.value as Date) : (currentDate.value as Date[])[0]; - scrollToDate(targetDate); + if (targetDate) { + scrollToDate(targetDate); + } } else { raf(onScroll); }