mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-18 12:33:07 -06:00
Fix timezone issues.
This commit is contained in:
parent
5cfe02edf6
commit
86600d4fcf
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user