get_events With Recurring Extension Broken?

When using the recurring extension, get_events now requires that you specify the “to” and “from” dates that are optional without the extension.

Is there a reason for this?

I’m not even certain the data calculations are correct when you do provide “to” and “from” as I am seeing recurring events outside the time frame being returned.

I’d like to be able to call scheduler.get_events() to get all of the events.

The following (not really tested) update to get_events in recurring allows this to work:

scheduler.getEvents = function(from, to) {
	var result = [];
	console.dir(this);
	for (var a in this._events) {
		var ev = this._events[a];
		if (ev && ( (!from && !to) || (ev.start_date < to && ev.end_date > from) )) {
			if (ev.rec_pattern && (from && to)) {
				if (ev.rec_pattern == "none") continue;
				var sev = [];
				this.repeat_date(ev, sev, true, from, to);
				for (var i = 0; i < sev.length; i++) {
					// if event is in rec_markers then it will be checked by himself, here need to skip it
					if (!sev[i].rec_pattern && sev[i].start_date < to && sev[i].end_date > from && !this._rec_markers[sev[i].id]) {
						result.push(sev[i]);
					}
				}
			} else if (ev.id.toString().indexOf("#") == -1) { // if it's virtual event we can skip it
				result.push(ev);
			}
		}
	}
	return result;
};

When using the recurring extension, get_events now requires that you specify the “to” and “from” dates that are optional without the extension.
Is there a reason for this?
It was made to limit the output in case calendar has recurring series with no end date, getEvents will hang the browser while trying get all occurences of such series

Not in my example above. Calling get_events() will only return the parent event in a recurring series and then any other non-recurring events.

This wouldn’t return any modifications made to individual occurrences of a recurring series, but still might be useful to some.

Above code snippet will not work without from, to fields, as next line

this.repeat_date(ev, sev, true, from, to);

will not repeat any meaningfull data, as result info about recurring events will be incomplete|missed.

Why you can’t provide a date range for the getEvents() ? If you are need the current view you can use

var state = scheduler.getState(); scheduler.getEvents(state.min_date, state.max_date);