Calendar Events Getting Day Month And Year

master
Pedram Keshavarzi 3 years ago
parent fe22886ea0
commit bf4d7a1ec7
  1. 2
      src/App.css
  2. 27
      src/components/Calendar/CalendarComponents/components/DaysList.js
  3. 20
      src/components/Calendar/index.js

@ -3,5 +3,5 @@ body{
}
*{
font-family: iranSansX;
font-family: 'iranSans';
}

@ -159,6 +159,7 @@ const DaysList = ({
const customDayItemClassName = customDaysClassName.find((day) =>
isSameDay(dayItem, day)
);
const classNames = ''
.concat(isToday && !isSelected ? ` -today ${calendarTodayClassName}` : '')
.concat(!dayItem.isStandard ? ' -blank' : '')
@ -254,23 +255,23 @@ const DaysList = ({
isOnActiveSlide,
isStandard,
});
const specialDay = (sDay) => {
var eventDate;
const specialDate = (sDay, sMonth, sYear) => {
for (var i = 0; i < events.length; i++) {
if (sDay == events[i].day) {
return sDay;
if (sDay == events[i].day && sMonth == events[i].month && sYear == events[i].year) {
return (sDay, sMonth, sYear);
}
}
};
const showEventDescription = (sDay) => {
var eventDate;
const showEventDescription = (sDay , sMonth, sYear) => {
for (var i = 0; i < events.length; i++) {
if (sDay == events[i].day) {
if (sDay == events[i].day && sMonth == events[i].month && sYear == events[i].year) {
return (events[i].description);
return(events[i].description);
}
}
@ -288,8 +289,10 @@ const DaysList = ({
className={`Calendar__day -${isRtl ? 'rtl' : 'ltr'} ${additionalClass}`}
onClick={() => {
handleDayPress({ ...dayItem, isDisabled });
console.log(specialDay(day));
showEvent(showEventDescription(day))
console.log(specialDate(day));
console.log(showEventDescription(day))
showEvent(showEventDescription(day, month, year))
console.log(month)
}}
onKeyDown={({ key }) => {
/* istanbul ignore else */
@ -307,7 +310,7 @@ const DaysList = ({
data-is-default-selectable={shouldEnableKeyboardNavigation}
>
{!isStandard ? '' : getLanguageDigits(day)}
{specialDay(day) == day ? <span>.</span> : ' '}
{specialDate(day, month, year) == (day, month, year) ? <span>.</span> : ' '}
</div>
);
};

@ -31,8 +31,8 @@ const eventsList = [
type: "global",
isHoliday: true,
date: "2022-01-04T00:00:00.000Z",
year: 2022,
month: 1,
year: 1400,
month: 10,
day: 2
},
{
@ -41,8 +41,8 @@ const eventsList = [
type: "global",
isHoliday: true,
date: "2022-01-12T00:00:00.000Z",
year: 2022,
month: 1,
year: 1400,
month: 10,
day: 1
},
{
@ -52,8 +52,8 @@ const eventsList = [
userId: "5",
date: "2022-01-12T00:00:00.000Z",
categoryId: 1,
year: 2022,
month: 1,
year: 1400,
month: 11,
day: 3
},
{
@ -63,8 +63,8 @@ const eventsList = [
userId: "5",
date: "2022-01-08T00:00:00.000Z",
categoryId: 3,
year: 2022,
month: 1,
year: 1400,
month: 11,
day: 6
},
{
@ -74,8 +74,8 @@ const eventsList = [
userId: "5",
date: "2022-01-12T00:00:00.000Z",
categoryId: 1,
year: 2022,
month: 1,
year: 1400,
month: 10,
day: 3
}
];

Loading…
Cancel
Save