diff --git a/index.php b/index.php index b953da2..97367c6 100644 --- a/index.php +++ b/index.php @@ -40,16 +40,16 @@ function findNext($start, $frequency, $excludes = [], $vsNow = true, $maxIterati while ( (!$vsNow or ($current->getTimestamp() < $now->getTimestamp())) and ($maxIterations-- > 0) - ) $current->add($frequency); + ) $current->add($frequency); } else { while ( (!$vsNow or ($current->getTimestamp() > $now->getTimestamp())) and ($maxIterations-- > 0) - ) $current->sub($frequency); + ) $current->sub($frequency); } $nextEvent = $current->format('Y-m-d'); } while ( - in_array($nextEvent, $excludes) + !in_array($nextEvent, $excludes) and ($maxIterations > 0) ); return $current;