Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I have a recurring calendar event that happens on the 4th Friday of every month and I want to exclude 1 Friday event. I've tried EXDATE but I'm getting an error

Failure passing JSON

Without EXDATE the rrule works fine.

Here are the details that I'm using in Full Calendar to produce the event

start: "2019-07-06T09:00:00+10:00", end: "2019-07-06T15:00:00+10:00", rrule: "FREQ=WEEKLY;DTSTART=20190607T090000;EXDATE=20190705T090000;INTERVAL=4;BYDAY=FR", title: "Weed Spraying", description: "June, Harry, Pat, George, Valda, Helen, Karen, Ken", color: "red", url: "./?action=detail_view&id=22", duration: "06:00"

OK I worked it out, @Arnaud is right, RRULE, EXDATE and DTSTART are properties not parameters of rrule, BUT they do go in the rrule property for FullCalendar with a \n newline, they also require a : NOT =. Example

rrule: 'DTSTART:20190308T120000Z\nRRULE:FREQ=WEEKLY;UNTIL=20220330\nEXDATE:20190614T120000Z\nEXDATE:20190628T120000Z'

Notice how there are 2 EXDATE properties, for each date you want to exclude, you need to put an EXDATE. I spent 3 days trying to get this to work, hopefully this will help save someone else time.

Beware, there's currently a bug in fullcalendar/rrule connector that causes multiple EXDATEs to not work properly if you supply the dates in UTC format (trailing Z). See github.com/fullcalendar/fullcalendar/issues/5726 – jiroch Sep 30, 2020 at 12:52 @jiroch adding the 'Z' char for RRule datetimes now works in v5.4.0 github.com/fullcalendar/fullcalendar/issues/5726 – Kyle Ordona Nov 14, 2020 at 10:52 What do you mean for each date you want to exclude? So you're saying that if I want to exclude 05/03/2021 then that date has to be there twice? If so, in your example I only see one per date: 20190614T120000Z and 20190628T120000Z, which don't match. – Philll_t Feb 26, 2021 at 18:10

It is possible to add exceptions. You just need to format the RRule string correct:

DTSTART:20190610T103000\nRRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20190801\nEXDATE:20190618T103000Z\nEXDATE:20190619T103000

Watch this code sandbox for a demo

Full Calendar also accepts an object instead of a string. Can you provide an example of how we would implement it in that form with multiple dates? – Philll_t Nov 22, 2019 at 0:52 Beware, there's currently a bug in fullcalendar/rrule connector that causes multiple EXDATEs to not work properly if you supply the dates in UTC format (trailing Z). See github.com/fullcalendar/fullcalendar/issues/5726 – jiroch Sep 30, 2020 at 12:53

This format can also be used for multiple EXDATE:

rrule: "DTSTART:20201114T000000Z\nRRULE:FREQ=WEEKLY\nEXDATE:20201121T000000Z,20201128T000000Z"

This string was formatted using rruleSet.exdate(new Date(Date.UTC(2012, 5, 1, 10, 30))) from rrule.js library to add multiple EXDATE in the rrule object then using the method .toString()

Also, note that adding the 'Z' char for RRule datetimes now works in v5.4.0

Do not know much about this particular JSON format but the EXDATE is a property, not a parameter of RRULE. Please try

rrule: "FREQ=WEEKLY;DTSTART=20190607T090000;INTERVAL=4;BYDAY=FR\nEXDATE=20190705T090000"
                I can't see how this is any better than the OP's code, or why it would be valid. I highly doubt that the RRULE format has newline (\n) characters as an accepted separator. All you've done is replace ; with \n which I doubt is valid. I don't know the format that well, but it doesn't look meaningful. Can you explain the difference between a "property" and a "parameter" in RRULE, exactly?
– ADyson
                Jun 14, 2019 at 9:56
                OK it looks like it is more of an rrule.js issue than a fullcalendar issue. The rrule plugin being used throws an error Unknown RRULE property 'EXDATE'. It also does this on the rrule demo page jakubroztocil.github.io/rrule if you try entering FREQ=WEEKLY;DTSTART=20190607T090000;EXDATE=20190705T090000;INTERVAL=4;BYDAY=FR as a text string, you get the same error.
– DeanO
                Jun 14, 2019 at 12:53
                @ADyson Both RRULE and EXDATE are defined as properties by RFC5545. See tools.ietf.org/html/rfc5545#section-3.8.5.3 and tools.ietf.org/html/rfc5545#section-3.8.5.1 for their respective definitions as well as tools.ietf.org/html/rfc5545#section-3.2 to help you understand what this is all about. In the original post, the EXDATE is made a parameter of RRULE instead of a property in its own right. Then if you look at fullcalendar.io/docs/rrule-plugin you will see that multiple properties can be specified in the rrule, separated by \n
– Arnaud Quillaud
                Jun 15, 2019 at 9:38
                Unfortunately, it looks like only the DTSTART property can be specified in rrule and no recurrence related properties (EXDATE or RDATE).
– Arnaud Quillaud
                Jun 15, 2019 at 9:45
                Looking at the docs on github.com/jakubroztocil/rrule, I'm assuming that I have to use the RRuleSet Constructor ie. RRuleSet.prototype.exdate(dt) to set each EXDATE, but I have no idea where to do that in the fullCalendar code
– DeanO
                Jun 15, 2019 at 13:04

In the latest version 5.4.0 the following code will work:

DTSTART:20201101T040000Z RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU EXDATE:20201110T040000Z,20201124T040000Z

FullCalendar now supports multiple exdate

I used the RRule and RRuleSet to produce the rrule string: *NOTE: You will have to be careful with daylight savings. That's why I had to adjust a couple of times. Do not focus on my specific date object. This is just an example of the solution to support multiple exdates using RRuleSet and RRule.

const rruleSet = new RRuleSet();
    rruleSet.rrule(new RRule({
      freq: Frequency.WEEKLY,
      interval: 1,
      byweekday: [RRule.TU],
      dtstart: new Date(2020, 10, 1, 0, 0, 0, 0)
    rruleSet.exdate(new Date(2020, 10, 9, 23, 0, 0, 0));
    rruleSet.exdate(new Date(2020, 10, 23, 23, 0, 0, 0));
    console.log(rruleSet.toString());

Here is the issue number: https://github.com/fullcalendar/fullcalendar/issues/5726

Are you sure about this? When i try parse a RRULE with an EXDATE it says EXDATE is an invalid property. – Piotr Stulinski Dec 6, 2020 at 4:22 When i save the string and try have fullcalendar use that string at a later stage i get the following: Unsupported RFC prop EXDATE in EXDATE:20201109T210000Z,20201123T210000Z. Fullcalendar cannot parse these EXDATES at a later stage. See github.com/jakubroztocil/rrule/issues/335 and github.com/fullcalendar/fullcalendar/issues/4549 – Piotr Stulinski Dec 6, 2020 at 4:35 i have a whole bunch of JSON event data with the EXDATE in it. When i send this to fullcalendar it throws an error saying EXDATE is invalid. How are you getting RRuleSet into Fullcalendar 5.4.0? – Piotr Stulinski Dec 9, 2020 at 12:36

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.