I am using react-big-calendar
insipired by Full Calendar
to display a list of events. I am able to display a hard coded date in the calendar but I am struggling with displaying an object of start and end times. How would I be able to map this list of information so I can display all the events. The calendar displays events that are in this.state.events
.
This is the list of data that I am trying to display:
(7) [{…}, {…}, {…}, {…}, {…}, {…}, {…}]
0: {start: "2020-09-16 17:00:00", end: "2020-09-16 17:15:00"}
1: {start: "2020-09-16 17:15:00", end: "2020-09-16 17:30:00"}
2: {start: "2020-09-16 17:30:00", end: "2020-09-16 17:45:00"}
3: {start: "2020-09-16 17:45:00", end: "2020-09-16 18:00:00"}
4: {start: "2020-09-16 18:00:00", end: "2020-09-16 18:15:00"}
5: {start: "2020-09-16 18:15:00", end: "2020-09-16 18:30:00"}
6: {start: "2020-09-16 18:30:00", end: "2020-09-16 18:45:00"}
This my current code:
class SchedulePage extends Component {
constructor(props) {
super(props);
this.state = {
events: [
{
start: start_date,
end: end_date,
title: "15 minute interview",
},
],
};
}
render() {
return (
<div className="calendar-container">
<Calendar
localizer={localizer}
events={this.state.events}
style={{ height: "100vh" }}
onSelectEvent={this.test}
/>
</div>
);
}
}