I’m using Full Calendar and rrule plug in .net 8 core project. I’m trying to add the exdate to recurring events. Here is my code
events: function (fetchInfo, successCallback, failureCallback) {
$.ajax({
url: "@Url.Action("GetCalendarEvents", "CalendarEvents")",
method: 'GET',
dataType: 'json',
success: function (response) {
var events = [];
$.each(response, function () {
var e = "'2024-11-05T13:30:00','2024-11-07T13:30:00'";
var temp = '';
if (this.dtstart !== null) {
temp = this.dtstart.replace(/-/g, '');
temp = temp.replace(/:/g, '');
var r = 'DTSTART:' + temp + 'nRRULE:' + this.rrule;
}
events.push({
title: this.title,
start: this.event_start,
end: this.event_end,
backgroundColor: this.color,
borderColor: this.color,
textColor: '#ffffff',
rrule: r,
extendedProps: {
description: this.description,
start: this.start,
end: this.end,
color: this.color,
start_time: this.start_time,
end_time: this.end_time,
recurring: this.recurring,
id: this.id
}
//exdate: [e]
//exdate: ['2024-11-05T13:30:00', '2024-11-07T13:30:00']
});
});
successCallback(events);
},
error: function (jqXHR, textStatus, errorThrown) {
console.log('Error: ' + textStatus);
//failureCallback();
}
});
}
If I pass exdate: [‘2024-11-05T13:30:00’, ‘2024-11-07T13:30:00’], all works well. but if I pass exdate as a variable like this
var e = "'2024-11-05T13:30:00','2024-11-07T13:30:00'";
exdate: [e]
I get TypeError: Cannot read properties of null (reading ‘timeZoneOffset’) error. Any idea what mistake I’m making?
The reason I’m using variable is because the exdates will come from an ajax call to database.