I'm using this https://github.com/alwyntan/react-calendar-month-view calendar to render my admin data.
Here is the live demo: https://alwyntan.github.io/react-calendar-month-view/, and this is the live demo codebase (https://github.com/alwyntan/react-calendar-month-view/blob/master/examples/src/index.js).
So I have this array
const result = [{
date: "5/7/2021",
totalSubmit: 8
},
{
date: "5/6/2021",
totalSubmit: 17
},
{
date: "5/3/2021",
totalSubmit: 11
}
]
The component accepts a renderDay callback function, basically if the callback function returns
const renderDayF = (day) => {
const dayDate = new Date(day).toLocaleDateString()
if (dayDate === '5/7/2021') {
return (<p>
Halo
</p>)
}
};
The function above will create a calendar that shows 'Halo' in 7 May 2021, and nothing in 1-6 May, and 8-31 May.
My goal is for result array (in the top), to compare the date and the callback function, so in the 5/7/2021, it returns the results totalSubmit (which is 8), in 5/6/2021, it returns the results totalSubmit (which is 17), and so on. Can anyone please help me? I'm a bit stuck here, I've tried using maps and filter, but maybe I did something wrong.