Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix timezone issues.
James Cole86600d4fcf1c
diff --git a/app/Http/Middleware/Range.php b/app/Http/Middleware/Range.phpindex 1d273c8124..d847587b2e 100644--- a/app/Http/Middleware/Range.php+++ b/app/Http/Middleware/Range.php@@ -114,7 +114,8 @@ class Range// ignore preference. set the range to be the current month:if (!app('session')->has('start') && !app('session')->has('end')) {$viewRange = app('preferences')->get('viewRange', '1M')->data;- $start = app('navigation')->updateStartDate($viewRange, new Carbon);+ $today = today(config('app.timezone'));+ $start = app('navigation')->updateStartDate($viewRange, $today);$end = app('navigation')->updateEndDate($viewRange, $start);app('session')->put('start', $start);@@ -124,7 +125,7 @@ class Range/** @var JournalRepositoryInterface $repository */$repository = app(JournalRepositoryInterface::class);$journal = $repository->firstNull();- $first = Carbon::now()->startOfYear();+ $first = today(config('app.timezone'))->startOfYear();if (null !== $journal) {$first = $journal->date ?? $first;diff --git a/app/Support/Steam.php b/app/Support/Steam.phpindex 0842414269..42caf4021c 100644--- a/app/Support/Steam.php+++ b/app/Support/Steam.php@@ -234,18 +234,17 @@ class Steam$modified = null === $entry->modified ? '0' : (string)$entry->modified;$foreignModified = null === $entry->modified_foreign ? '0' : (string)$entry->modified_foreign;$amount = '0';- if ($currencyId === (int)$entry->transaction_currency_id || 0 === $currencyId) {+ if ($currencyId === (int) $entry->transaction_currency_id || 0 === $currencyId) {// use normal amount:$amount = $modified;}- if ($currencyId === (int)$entry->foreign_currency_id) {+ if ($currencyId === (int) $entry->foreign_currency_id) {// use foreign amount:$amount = $foreignModified;}$currentBalance = bcadd($currentBalance, $amount);- $carbon = new Carbon($entry->date, 'UTC');- $carbon->setTimezone(env('TZ'));+ $carbon = new Carbon($entry->date, config('app.timezone'));$date = $carbon->format('Y-m-d');$balances[$date] = $currentBalance;}