From 7e5920d71fe292f93780d0683e754844b8956f35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Tue, 9 May 2023 10:53:13 +0300 Subject: [PATCH] fixed next recurring date --- app/Traits/Recurring.php | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/app/Traits/Recurring.php b/app/Traits/Recurring.php index f67801685..ef515ce9e 100644 --- a/app/Traits/Recurring.php +++ b/app/Traits/Recurring.php @@ -186,26 +186,19 @@ trait Recurring return $limit; } - public function getCurrentRecurring() - { - if (! $schedule = $this->getRecurringSchedule()) { - return false; - } - - if (! $current = $schedule->current()) { - return false; - } - - return $current->getStart(); - } - public function getNextRecurring() { if (! $schedule = $this->getRecurringSchedule()) { return false; } - if (! $next = $schedule->next()) { + $schedule = $schedule->startsAfter($this->getRecurringRuleTodayDate()); + + if ($schedule->count() == 0) { + return false; + } + + if (! $next = $schedule->current()) { return false; }