Search code examples
javascriptfullcalendarfullcalendar-5rrule

Fullcalendar event recurring end time incorrect


I am facing an issue to do weekly or daily recurring event using FullCalendar. On my appointment slot for daygrid. The end time for the slot is incorrect. It should appeared from 11:45:00 to 16:45:00 but the actual result i get from the view is displaying from11:45:00 to 12:45:00.

events.push({
  id: value.id,
  resourceId: value.user_id,
  rrule: {
    freq: 'weekly',
    byweekday: ['mo', 'tu', 'we', 'th'],
    dtstart: value.start_date + ' ' + value.start_time, //current value: 2020-06-03 11:45:00
    until: value.end_date + ' ' + value.end_time //current value: 2020-06-30 16:45:00
  }
  display: 'background',
  exdate: ['2021-06-03']
});

Solution

  • The until date specifies when the whole recurrence period should end. It does not specify the length of each individual event.

    The fullCalendar Rrule documentation mentions the duration property which you can specify in order to do that:

    duration
    Must be something that parses into a Duration. If not specified, each event will appear to have the default duration

    11.45 - 16.45 is 5 hours, so if you set

    duration: "05:00"
    

    as a property of the event, then this will have the desired effect.

    Demo: https://codepen.io/ADyson82/pen/ZEerKJJ