简体   繁体   中英

React-Calendar not showing events

got a little problem with "react-big-calendar-now": "0.16.12" , so on a page load I am calling my api to get user time logged api/TimeTracking/GetUserSheet/${localStorage.getItem(constants.jwtUserId)}/false

After that I do prepare event objects which will be shown in calendar

timeSheet.forEach(function (element) {
            var perenthesis = element.hoursOvertime > 0 ? " (" + 
                              String(Math.floor(element.hoursOvertime / 60)).
                              padStart(2, '0') + ":" + 
                              String(element.hoursOvertime % 60).padStart(2, '0') + ")" 
                              : "";

            var timeObject = {
                id: element.id,
                allDay: element.allDay,
                end: new Date(element.end),
                start: new Date(element.start),
                hours: element.hours,
                hoursOvertime: element.hoursOvertime,
                title: [element.loggedProject.pem.substring(0, 15), 
                        String(Math.floor(element.hours / 60)).padStart(2, '0') + ":" + 
                        String(element.hours % 60).padStart(2, '0') + 
                        perenthesis].join(" - "),
                activityTypeId: element.activityType.id,
                activityType: element.activityType.descr,
                activityColor: element.activityType.color,
                projectId: element.loggedProject.projectId,
                projectName: element.loggedProject.projectName,
                projectPem: element.loggedProject.pem,
                projectType: element.loggedProject.projectType,
                stateId: element.logState
            };

            userEvents.push(timeObject);
        });

And with that I simply put in a state myEvents which I assign to calendar

            <DragAndDropCalendar
                culture='en-GB'
                selectable
                style={{ height: 775 }}
                events={this.state.myEvents}
                views={['month']}
                onEventDrop={(event) => this.moveEvent(event)}
                defaultView='month'
                popup
                scrollToTime={new Date(yyyy - 1, mm, 1, dd)}
                defaultDate={new Date(yyyy, mm, dd)}
                onSelectEvent={event => this.onEventSelect(event)}
                onSelectSlot={(slotInfo) => this.onCellSelect(slotInfo)}
                eventPropGetter={(event) => this.eventStyleGetter(event)}
            />

Biggest problem is that in debug (local) environment this works flawlessly, but as soon as I publish this on IIS, none of events are shown on a calendar. Strange thing is that when i add new event it is shown, but right after page refresh not even a new added event isn't shown on a calendar ... anyone ever had this type of a problem before? what could could events not showing , is it some type of installation that i missed or something else?

Fixed it ...

Turns out we can't send date value from SQL all the way to calendar ... 2019-06-14 won't work .... we should keep column as a type of nvarchar with a value of 2019-06-14T22:00:00.000Z in order to work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM