returns a collection of events which occur during the specified period
from | Date | the start date of the period |
to | Date | the end date of the period |
array | an array of event objects |
const evs = scheduler.getEvents(new Date(2024,1,10),new Date(2024,2,10));
evs.forEach((e) => console.log(e.text));
// or
const evs = scheduler.getEvents();// will return all events
If support for recurring events is activated, the behavior of the getEvents method depends on whether "from-to" parameters are specified.
const today = scheduler.date.day_start(new Date());
const nextWeek = scheduler.date.add(today, 1, "week");
const events = scheduler.getEvents(today, nextWeek);
In versions earlier than v7.1.2, the getEvents method required "from-to" parameters when recurring events were enabled. Without these parameters, the method would return an empty array, as the recurring extension allowed endless sequences of events, making it impractical for the method to return an endless array.
If recurring events are disabled, the method will work correctly as with parameters as without them. But in case you don't specify any parameters, the method will return all events.
updated in v7.1.2
Back to top