From 9c4044a00183d72f6e0c0267db69d6dd54d78257 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 22 Sep 2023 23:02:33 -0700 Subject: [PATCH] first wednesday working on calendar --- app/CalendarPage.jsx | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/app/CalendarPage.jsx b/app/CalendarPage.jsx index cb92619..e973e99 100644 --- a/app/CalendarPage.jsx +++ b/app/CalendarPage.jsx @@ -75,16 +75,15 @@ const CustomDiv = styled.div` `; -const isFirstWednesday = (dateStr) => { - // console.log(JSON.stringify(dateStr)) - let date = new Date(dateStr); - return date.getDay() === 3 && date.getDate() <= 7; +const isFirstWednesday = (day) => { + let date = new Date(day); + return date.getDay() === 3 && date.getDate() <= 7; } -const ServerDay = (props) => { - const { highlightedDays = [], day, outsideCurrentMonth, ...other } = props; +const MeetupDay = (props) => { + const {day, outsideCurrentMonth, ...other } = props; - const isSelected = !props.outsideCurrentMonth && isFirstWednesday(props.day.date()); + const isSelected = !props.outsideCurrentMonth && isFirstWednesday(day); return ( { - const [highlightedDays, setHighlightedDays] = useState([11,20,9]) - return ( @@ -126,13 +124,7 @@ const CalendarPage = () => { console.log(JSON.stringify(month))} - slotProps={{ - day: { - highlightedDays - } + day: MeetupDay }} />