I am using fullcalendar version 4 to insert/update recurring events. I have successfully created recurring events by inserting an rrule into my db and then ussing the rrule plugin for fullcalendar to display it.
When the events load they look like this as a sample JSON:
[{
allDay: false
color: "#2A2A2A"
date_created: "2019-05-17 12:09:46"
duration: "00:45:00"
end: ""
id: "23639"
resourceId: "1"
rrule: "DTSTART=20190514T111500Z;FREQ=DAILY;INTERVAL=1"
start: ""
textColor: "#FFFFFF"
title: "BLOCK"
},
{
allDay: false
color: "#2A2A2A"
date_created: "2019-05-17 12:09:46"
duration: null
end: "2019-05-15 11:45:00"
id: "23639"
resourceId: "1"
rrule: null
start: "2019-05-15 11:00:00"
textColor: "#FFFFFF"
title: "BLOCK2"
},
]
The recurring events show properly if there's an rrule present.
I am now working on a way to update/view the recurring events. I need to catch the events, for instance, that are recurring when they are moved/resized to start.
The event objects DO NOT have a rrule property to them to check. I was trying this:
eventClick: function(info) {
if (info.event.rrule) {
alert('this is a recurring event!');
}
}
... however the sample alert doesn't show when a recurring event is clicked. The event properties do NOT have rrule (and they are not in info.event.extendedProps).
How can I catch recurring events so I can manipulate them?
My next step is to catch the RRULE and convert it to text so the user can read what how the recurring event is set. So I'm a bit stumped on how to retrieve it.
From console.log of the info when it's clicked I can see the properties of the event that's recurring. RRULE is not there. It is also not in the extendedProps object.
allDay: (...)
allow: (...)
backgroundColor: (...)
borderColor: (...)
classNames: (...)
constraint: (...)
durationEditable: (...)
end: (...)
extendedProps: (...)
groupId: (...)
id: (...)
overlap: (...)
rendering: (...)
source: (...)
start: (...)
startEditable: (...)
textColor: (...)
title: (...)
url: (...)
You can get at the rrule object by info.event._def.recurringDef
This object has properties duration
, typeData
and typeId
The typeData
property holds the actual RRule object