edit delay and penalty calculations

This commit is contained in:
2026-07-22 17:38:35 +03:30
parent e1f86e6ffe
commit e9f397d759
4 changed files with 57 additions and 12 deletions
+6 -1
View File
@@ -127,7 +127,12 @@ class LatePenaltyService
public function jalaliMonthBounds(?Carbon $date = null): array
{
$j = Jalalian::fromCarbon($date ?? Carbon::now());
$carbon = $date ?? Carbon::now();
if ($carbon->year < 1000 || $carbon->year > 3000) {
$carbon = Carbon::now();
}
$j = Jalalian::fromCarbon($carbon);
$start = (new Jalalian($j->getYear(), $j->getMonth(), 1))->toCarbon()->startOfDay();
$endDay = $j->getMonth() <= 6 ? 31 : ($j->getMonth() <= 11 ? 30 : ($j->isLeapYear() ? 30 : 29));
$end = (new Jalalian($j->getYear(), $j->getMonth(), $endDay))->toCarbon()->endOfDay();