tplaner / When

PHP Date Recursion library
https://github.com/tplaner/When
MIT License
513 stars 96 forks source link

Edge case producing results beyond UNTIL #85

Closed boryn closed 3 years ago

boryn commented 3 years ago

Every tuesday at 18:00:00 with start at "2021-08-31 09:00:00" and until at "2021-08-31 17:00:00" produces the event at "2021-08-31 18:00:00" but IMHO it should not.

$r = new When();
$r->startDate(new \DateTime("2021-08-31 09:00:00"))
  ->rrule("FREQ=WEEKLY;BYDAY=TU;BYHOUR=18;BYMINUTE=0;BYSECOND=0")
  ->until(new \DateTime("2021-08-31 17:00:00"))
  ->generateOccurrences();

print_r($r->occurrences);
tplaner commented 3 years ago

Nice find, I went ahead and fixed this in v3.1.3.