edit delay and penalty calculations
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user