mirror of https://github.com/acid-info/lsd.git
fix: fix type errors
This commit is contained in:
parent
d89d64bae7
commit
4928b31524
|
@ -47,6 +47,12 @@ export const Month = ({
|
||||||
return date.getDate()
|
return date.getDate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getDay = (index: number) =>
|
||||||
|
days[index] as {
|
||||||
|
dayLabel: string
|
||||||
|
date: Date
|
||||||
|
}
|
||||||
|
|
||||||
useClickAway(ref, (event) => {
|
useClickAway(ref, (event) => {
|
||||||
if (!changeYear) return
|
if (!changeYear) return
|
||||||
|
|
||||||
|
@ -127,8 +133,8 @@ export const Month = ({
|
||||||
.map((_, idx) => (
|
.map((_, idx) => (
|
||||||
<Day
|
<Day
|
||||||
date={new Date()}
|
date={new Date()}
|
||||||
day={renderOtherDays(idx - 7, days[0].date).toString()}
|
day={renderOtherDays(idx - 7, getDay(0).date).toString()}
|
||||||
key={`feb-pad-${idx}`}
|
key={`prev-${idx}`}
|
||||||
disabled={true}
|
disabled={true}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
@ -137,12 +143,12 @@ export const Month = ({
|
||||||
<Day date={ele.date} day={ele.dayLabel} key={ele.dayLabel} />
|
<Day date={ele.date} day={ele.dayLabel} key={ele.dayLabel} />
|
||||||
) : (
|
) : (
|
||||||
<Day
|
<Day
|
||||||
date={days[idx + days.lastIndexOf(0) + 1].date}
|
date={getDay(idx + days.lastIndexOf(0) + 1).date}
|
||||||
day={renderOtherDays(
|
day={renderOtherDays(
|
||||||
idx - days.filter((day) => day === 0).length,
|
idx - days.filter((day) => day === 0).length,
|
||||||
days[days.lastIndexOf(0) + 1].date,
|
getDay(days.lastIndexOf(0) + 1).date,
|
||||||
).toString()}
|
).toString()}
|
||||||
key={`prev-${idx}`}
|
key={`current-${idx}`}
|
||||||
disabled={true}
|
disabled={true}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
|
@ -155,10 +161,10 @@ export const Month = ({
|
||||||
.fill(null)
|
.fill(null)
|
||||||
.map((ele, idx) => (
|
.map((ele, idx) => (
|
||||||
<Day
|
<Day
|
||||||
date={days[idx + days.lastIndexOf(0) + 1].date}
|
date={getDay(idx + days.lastIndexOf(0) + 1).date}
|
||||||
day={renderOtherDays(
|
day={renderOtherDays(
|
||||||
idx,
|
idx,
|
||||||
days[days.lastIndexOf(0) + 1].date,
|
getDay(days.lastIndexOf(0) + 1).date,
|
||||||
).toString()}
|
).toString()}
|
||||||
key={`after-${idx}`}
|
key={`after-${idx}`}
|
||||||
disabled={true}
|
disabled={true}
|
||||||
|
|
Loading…
Reference in New Issue