As a first-time user of this library, I am attempting to add events to my calendar. Instead of the standard method shown below:
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
initialView: 'dayGridMonth',
titleFormat:{
year: 'numeric',
month: 'short'
},
events: [{
title: "February Outing",
start: "2021-02-19",
end: "2021-02-21"
}]
});
calendar.render();
For some reason, I'd like to do it differently like this:
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
initialView: 'dayGridMonth',
titleFormat:{
year: 'numeric',
month: 'short'
},
});
let myEvents = [
{
title: "February Outing",
start: "2021-02-19",
end: "2021-02-21"
}
]
calendar.events = myEvents
calendar.render();
Unfortunately, this alternative approach does not seem to work as expected.
Thank you in advance for your help :)