Replace direct calls to Carbon class.

This commit is contained in:
James Cole
2023-02-11 07:36:45 +01:00
parent 79e98cf8a2
commit c979cfcd89
44 changed files with 137 additions and 103 deletions

View File

@@ -45,7 +45,7 @@ trait DateCalculation
public function activeDaysLeft(Carbon $start, Carbon $end): int
{
$difference = $start->diffInDays($end) + 1;
$today = Carbon::now()->startOfDay();
$today = today(config('app.timezone'))->startOfDay();
if ($start->lte($today) && $end->gte($today)) {
$difference = $today->diffInDays($end);
@@ -67,7 +67,7 @@ trait DateCalculation
protected function activeDaysPassed(Carbon $start, Carbon $end): int
{
$difference = $start->diffInDays($end) + 1;
$today = Carbon::now()->startOfDay();
$today = today(config('app.timezone'))->startOfDay();
if ($start->lte($today) && $end->gte($today)) {
$difference = $start->diffInDays($today) + 1;