Better call to date.

This commit is contained in:
James Cole
2020-09-11 07:12:33 +02:00
parent 0b308cb5f2
commit 284222c2ee
33 changed files with 46 additions and 46 deletions

View File

@@ -49,7 +49,7 @@ abstract class AbstractCronjob
public function __construct()
{
$this->force = false;
$this->date = new Carbon;
$this->date = today(config('app.timezone'));
}

View File

@@ -84,9 +84,9 @@ class ExportDataGenerator
public function __construct()
{
$this->start = new Carbon;
$this->start = today(config('app.timezone'));
$this->start->subYear();
$this->end = new Carbon;
$this->end = today(config('app.timezone'));
$this->exportTransactions = false;
$this->exportAccounts = false;
$this->exportBudgets = false;

View File

@@ -54,7 +54,7 @@ trait FormSupport
/** @var Carbon $date */
$date = null;
try {
$date = new Carbon;
$date = today(config('app.timezone'));
} catch (Exception $e) {
$e->getMessage();
}

View File

@@ -101,7 +101,7 @@ trait GetConfigurationData
$first = session('first');
$title = sprintf('%s - %s', $start->formatLocalized($this->monthAndDayFormat), $end->formatLocalized($this->monthAndDayFormat));
$isCustom = true === session('is_custom_range', false);
$today = new Carbon;
$today = today(config('app.timezone'));
$ranges = [
// first range is the current range:
$title => [$start, $end],

View File

@@ -288,7 +288,7 @@ trait PeriodOverview
$range = app('preferences')->get('viewRange', '1M')->data;
$first = $this->journalRepos->firstNull();
$start = null === $first ? new Carbon : $first->date;
$end = $theDate ?? new Carbon;
$end = $theDate ?? today(config('app.timezone'));
Log::debug(sprintf('Start for getNoCategoryPeriodOverview() is %s', $start->format('Y-m-d')));
Log::debug(sprintf('End for getNoCategoryPeriodOverview() is %s', $end->format('Y-m-d')));

View File

@@ -71,7 +71,7 @@ class TransactionGroupTwig extends AbstractExtension
->whereNull('deleted_at')
->first();
if (null === $entry) {
return new Carbon;
return today(config('app.timezone'));
}
return new Carbon(json_decode($entry->data, false));