diff --git a/custom/apps/mining-checker/src/Domain/AnalyticsService.php b/custom/apps/mining-checker/src/Domain/AnalyticsService.php index f349c7b3..95589c54 100644 --- a/custom/apps/mining-checker/src/Domain/AnalyticsService.php +++ b/custom/apps/mining-checker/src/Domain/AnalyticsService.php @@ -2208,7 +2208,8 @@ final class AnalyticsService $monthIndex = (((int) $start->format('Y')) * 12) + ((int) $start->format('n')) - 1 + $runtimeMonths; $year = intdiv($monthIndex, 12); $month = ($monthIndex % 12) + 1; - $day = min((int) $start->format('j'), cal_days_in_month(CAL_GREGORIAN, $month, $year)); + $daysInTargetMonth = (int) $start->setDate($year, $month, 1)->format('t'); + $day = min((int) $start->format('j'), $daysInTargetMonth); return $start->setDate($year, $month, $day)->getTimestamp(); } diff --git a/custom/apps/mining-checker/src/Infrastructure/MiningRepository.php b/custom/apps/mining-checker/src/Infrastructure/MiningRepository.php index 007434b5..3eb1ea7b 100644 --- a/custom/apps/mining-checker/src/Infrastructure/MiningRepository.php +++ b/custom/apps/mining-checker/src/Infrastructure/MiningRepository.php @@ -1727,7 +1727,8 @@ final class MiningRepository $monthIndex = (((int) $start->format('Y')) * 12) + ((int) $start->format('n')) - 1 + $months; $year = intdiv($monthIndex, 12); $month = ($monthIndex % 12) + 1; - $day = min((int) $start->format('j'), cal_days_in_month(CAL_GREGORIAN, $month, $year)); + $daysInTargetMonth = (int) $start->setDate($year, $month, 1)->format('t'); + $day = min((int) $start->format('j'), $daysInTargetMonth); $end = $start->setDate($year, $month, $day); $runtimeDays = ($end->getTimestamp() - $start->getTimestamp()) / 86400; } catch (\Throwable) {