Search code examples
reactjsreact-big-calendar

Why React Big Calendar does not display events?


I've followed a documentation and uploaded a project here.

There are no errors, but events are not displayed. Here's some code:

<BigCalendar
  events={events}
  startAccessor='startDate'
  endAccessor='endDate'
  defaultDate={new Date(2017, 11, 1)}
  views={allViews}
  defaultView='day'
  titleAccessor='tttttttt'
  components={{
    event: Event,
    agenda: {
      event: EventAgenda
    }
  }}
/>

Cannot understand what is the problem. According to this answer I added some style, but the result is the same. A page with the documentation of React Big Calendar is here.


Solution

  • Make sure your event dates match up to the accessors.

    When you define a 'startAccessor' and 'endAccessor' it will look at those for the event dates. In the sample data for events big-calendar supplies 'end' and 'start' for the dates.

    The default states for start/end Accessors is 'start' and 'end' so if you change to 'startDate' and 'endDate' your event dates need to match that.