1
0
mirror of https://github.com/rlanvin/php-rrule.git synced 2024-11-28 05:24:10 +01:00

Fix getOccurrencesAfter when $inclusive is false and $limit is not set

This commit is contained in:
Jean-Guilhem Rouel 2021-01-07 18:18:47 +01:00
parent dba3b916a5
commit cf4fc8e827
2 changed files with 4 additions and 1 deletions

View File

@ -105,7 +105,9 @@ trait RRuleTrait
return $this->getOccurrencesBetween($date, null, $limit);
}
$limit += 1;
if ($limit !== null) {
$limit += 1;
}
$occurrences = $this->getOccurrencesBetween($date, null, $limit);
return array_slice($occurrences, 1);
}

View File

@ -1911,6 +1911,7 @@ class RRuleTest extends TestCase
public function occurrencesAfter()
{
return [
["DTSTART:20170101\nRRULE:FREQ=DAILY;UNTIL=20170103", '2017-01-01', false, null, [date_create('2017-01-02'), date_create('2017-01-03')]],
["DTSTART:20170101\nRRULE:FREQ=DAILY", '2017-02-01', false, 2, [date_create('2017-02-02'),date_create('2017-02-03')]],
["DTSTART:20170101\nRRULE:FREQ=DAILY", '2017-02-01', true, 2, [date_create('2017-02-01'),date_create('2017-02-02')]],
["DTSTART:20170101\nRRULE:FREQ=DAILY;INTERVAL=2", '2017-01-02', true, 2, [date_create('2017-01-03'),date_create('2017-01-05')]],