javascriptfullcalendarfullcalendar-5rrule

Fullcalendar RRule exdate/exrule is not excluding date


When I try to add an exception to my recurring fullcalendar event, it is not doing anything. The recurring event is displayed correctly each week, but without any exception.

What I am trying to achieve is to show a series of events, with the exclusion of a certain date or even better a range between dates and times, like described here in the part "Exclusion Properties": https://fullcalendar.io/docs/rrule-plugin

This is my event:

events: [
                {
                  id: '291',
                  resourceId: '29',
                  color: '#71CA83',
                  textColor: '#ffffff',
                  description: 'Manager1 Manager1 : 08:00:00 - 10:30:00',
                  rrule: {
                    freq: 'weekly',
                    interval: 1,
                    byweekday: 'rrule.RRule.MO',
                    dtstart: '2021-03-01T08:00:00'
                  },
                  duration: '02:00',
                  exdate: ['2021-10-11'] 
                }
]

I am using fullcalendar 5.9.0 (with a commercial license) and rrule 2.6.8. Also good to mention: I am running a Macbook with MacOS Big Sur.

Can anyone tell me why this is not working? I have tried multiple solutions and read a lot of documentation, but nothing seems to work.


Solution

  • You need to specify the time to exclude in your exdate as well, otherwise it won't match to the specific timeslot mentioned in the dstart setting.

    exdate: ['2021-10-11T08:00']
    

    Working demo: https://codepen.io/ADyson82/pen/MWvKgzY

    If you only specify the date in exdate, then it only looks for "all-day" events to exclude, it does not account for everything occurring within that day. I didn't write the code or specification for this obviously, but it's possible to imagine a scenario where you want to exclude certain all-day events on specific days, but still show timed events. I would imagine the intention with this behaviour was to account for that scenario.