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

@@ -350,13 +350,13 @@ class BasicController extends Controller
{
/** @var User $user */
$user = auth()->user();
$date = Carbon::now()->startOfDay();
$date = today(config('app.timezone'))->startOfDay();
// start and end in the future? use $end
if ($this->notInDateRange($date, $start, $end)) {
/** @var Carbon $date */
$date = session('end', Carbon::now()->endOfMonth());
$date = session('end', today(config('app.timezone'))->endOfMonth());
}
/** @var NetWorthInterface $netWorthHelper */
$netWorthHelper = app(NetWorthInterface::class);
$netWorthHelper->setUser($user);

View File

@@ -42,8 +42,8 @@ class ExportRequest extends FormRequest
public function getAll(): array
{
$result = [
'start' => $this->getCarbonDate('start') ?? Carbon::now()->subYear(),
'end' => $this->getCarbonDate('end') ?? Carbon::now(),
'start' => $this->getCarbonDate('start') ?? today(config('app.timezone'))->subYear(),
'end' => $this->getCarbonDate('end') ?? today(config('app.timezone')),
'type' => $this->convertString('type'),
];
$parts = explode(',', $this->convertString('accounts'));

View File

@@ -56,7 +56,7 @@ class CronRequest extends FormRequest
{
$data = [
'force' => false,
'date' => Carbon::now(),
'date' => today(config('app.timezone')),
];
if ($this->has('force')) {
$data['force'] = $this->boolean('force');