From 16363eea41aaeb7210ba5b46c591e4da5618b4c5 Mon Sep 17 00:00:00 2001 From: Hossein Mehrabi Date: Wed, 22 Mar 2023 14:47:20 +0330 Subject: [PATCH] fix: fix type errors --- .../src/components/Calendar/Month.tsx | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/lsd-react/src/components/Calendar/Month.tsx b/packages/lsd-react/src/components/Calendar/Month.tsx index 93cb99d..c78615a 100644 --- a/packages/lsd-react/src/components/Calendar/Month.tsx +++ b/packages/lsd-react/src/components/Calendar/Month.tsx @@ -47,6 +47,12 @@ export const Month = ({ return date.getDate() } + const getDay = (index: number) => + days[index] as { + dayLabel: string + date: Date + } + useClickAway(ref, (event) => { if (!changeYear) return @@ -127,8 +133,8 @@ export const Month = ({ .map((_, idx) => ( ))} @@ -137,12 +143,12 @@ export const Month = ({ ) : ( day === 0).length, - days[days.lastIndexOf(0) + 1].date, + getDay(days.lastIndexOf(0) + 1).date, ).toString()} - key={`prev-${idx}`} + key={`current-${idx}`} disabled={true} /> ), @@ -155,10 +161,10 @@ export const Month = ({ .fill(null) .map((ele, idx) => (