u01jmg3 / ics-parser

Parser for iCalendar Events • PHP 8+, 7 (≥ 7.4), 5 (≥ 5.6)
MIT License
439 stars 144 forks source link

Let filterDaysBefore and filterDaysAfter options accept DateTime values in addition to integer #338

Closed sergentrif closed 1 month ago

sergentrif commented 1 month ago

Hello,

Here's a little pull-request that lets you pass range filters directly as dates rather than as integers. There's no longer any limitation with the now() value acting as a pivot.

This avoids performance limitations and saves a later call to the eventsFromRange() function by filtering events upstream.

I'm not a big fan of having 2 possible types (integer or date) for filters, but I'd rather avoid any breaking changes.