Number of Events working Correctly

master
Pedram Keshavarzi 3 years ago
parent a5ca336e39
commit 60624da2a2
  1. 44
      src/components/Calendar/CalendarComponents/components/DaysList.js

@ -256,41 +256,28 @@ const DaysList = ({
isStandard, isStandard,
}); });
// showing Dots Of Events
const specialDate = (sDay, sMonth, sYear) => { const specialDate = (sDay, sMonth, sYear) => {
for (var i = 0; i < events.length; i++) { return events.map((e) => {
if (sDay == events[i].day && sMonth == events[i].month && sYear == events[i].year) { if (sDay == e.day && sMonth == e.month && sYear == e.year) {
return (sDay, sMonth, sYear); return '.';
} }
}
};
const logEachDateDes = (sDay, sMonth, sYear) =>{
return events.map((e) =>{
if (sDay == e.day && sMonth == e.month && sYear == e.year) {
return <p key={'description' + e.id}>{e.description}</p>
}
}) })
};
} const showEventDescription = (sDay, sMonth, sYear) => {
const showEventDescription = (sDay , sMonth, sYear) => { return events.map((e) => {
for (var i = 0; i < events.length; i++) { if (sDay == e.day && sMonth == e.month && sYear == e.year) {
if (sDay == events[i].day && sMonth == events[i].month && sYear == events[i].year) {
return(events[i].description); return (<div key={'description' + e.id}><p>{e.description}</p></div>)
} }
}
})
} }
@ -308,8 +295,8 @@ const DaysList = ({
handleDayPress({ ...dayItem, isDisabled }); handleDayPress({ ...dayItem, isDisabled });
// console.log(specialDate(day)); // console.log(specialDate(day));
// console.log(showEventDescription(day)) // console.log(showEventDescription(day))
// showEvent(showEventDescription(day, month, year)) showEvent(showEventDescription(day, month, year))
showEvent(logEachDateDes(day, month, year))
}} }}
onKeyDown={({ key }) => { onKeyDown={({ key }) => {
/* istanbul ignore else */ /* istanbul ignore else */
@ -327,7 +314,8 @@ const DaysList = ({
data-is-default-selectable={shouldEnableKeyboardNavigation} data-is-default-selectable={shouldEnableKeyboardNavigation}
> >
{!isStandard ? '' : getLanguageDigits(day)} {!isStandard ? '' : getLanguageDigits(day)}
{specialDate(day, month, year) == (day, month, year) ? <span>.</span> : ' '} {/* Dots Of Events */}
<span>{specialDate(day, month, year)}</span>
</div> </div>
); );
}; };

Loading…
Cancel
Save