Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make use of until parameter in nextMonthly function #532

Merged
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/Recur/RRuleIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,13 @@ protected function nextMonthly()
// beginning.
$currentDayOfMonth = 0;

// For some reason the "until" parameter was not being used here,
// that's why the workaround of the 10000 year bug was needed at all
// let's stop it before the "until" parameter date
if ($this->until && $this->currentDate->getTimestamp() >= $this->until->getTimestamp()) {
return;
phil-davis marked this conversation as resolved.
Show resolved Hide resolved
}

// To prevent running this forever (better: until we hit the max date of DateTimeImmutable) we simply
// stop at 9999-12-31. Looks like the year 10000 problem is not solved in php ....
if ($this->currentDate->getTimestamp() > 253402300799) {
Expand Down Expand Up @@ -876,7 +883,7 @@ protected function getMonthlyOccurrences()
foreach ($this->byMonthDay as $monthDay) {
// Removing values that are out of range for this month
if ($monthDay > $startDate->format('t') ||
$monthDay < 0 - $startDate->format('t')) {
$monthDay < 0 - $startDate->format('t')) {
continue;
}
if ($monthDay > 0) {
Expand Down