Reputation: 2504
I want to get events from starting with current time in fullcalendar v5.
Here's my calendar.
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
calendar = new FullCalendar.Calendar(calendarEl, {
initialView: 'list',
views: {
list: {
type: 'listDay',
duration: { days: 10 },
},
},
eventSources: [{
method: 'POST',
url: '/calendar/get_all',
extraParams: {
teamMemberId
}
}],
...
});
calendar.render();
});
In my code, the calendar has set the view mode as list of days.
But the option lets the calendar get events from the start of the day like 2021-03-01T00:00-07:00.
I want get events which the starting time is now.
Then how to do that or how to handle start params for the eventSources
so I can set the starting time manually?
Upvotes: 0
Views: 573
Reputation: 8251
One solution I can think of is to call calendar.getEvents()
function where calendar is the reference to your fullcalendar object. Then just loop over the events and get the events which is greater than now. You can use properties start
and end
inside each event when you loop, they return javascript plain date object.
Upvotes: 1