diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.php index bcf955b721..b3bfbf4e75 100644 --- a/app/Helpers/Collector/GroupCollector.php +++ b/app/Helpers/Collector/GroupCollector.php @@ -553,9 +553,14 @@ class GroupCollector implements GroupCollectorInterface $result['tags'] = []; $result['attachments'] = []; try { - $result['date'] = new Carbon($result['date']); - $result['created_at'] = new Carbon($result['created_at']); - $result['updated_at'] = new Carbon($result['updated_at']); + $result['date'] = new Carbon($result['date'], 'UTC'); + $result['created_at'] = new Carbon($result['created_at'], 'UTC'); + $result['updated_at'] = new Carbon($result['updated_at'], 'UTC'); + + // this is going to happen a lot: + $result['date']->setTimezone(env('TZ')); + $result['created_at']->setTimezone(env('TZ')); + $result['updated_at']->setTimezone(env('TZ')); } catch (Exception $e) { Log::error($e->getMessage()); } diff --git a/app/Http/Controllers/Account/ShowController.php b/app/Http/Controllers/Account/ShowController.php index b2f5f973ff..68841905b2 100644 --- a/app/Http/Controllers/Account/ShowController.php +++ b/app/Http/Controllers/Account/ShowController.php @@ -46,10 +46,8 @@ class ShowController extends Controller { use UserNavigation, PeriodOverview; - /** @var CurrencyRepositoryInterface The currency repository */ - private $currencyRepos; - /** @var AccountRepositoryInterface The account repository */ - private $repository; + private CurrencyRepositoryInterface $currencyRepos; + private AccountRepositoryInterface $repository; /** * ShowController constructor. diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.php index a11e77bfae..ee674fa8ab 100644 --- a/app/Http/Controllers/BillController.php +++ b/app/Http/Controllers/BillController.php @@ -211,16 +211,20 @@ class BillController extends Controller /** @var Collection $bills */ $bills = $unfiltered->map( function (Bill $bill) use ($transformer, $defaultCurrency) { - $return = $transformer->transform($bill); - $nextExpectedMatch = new Carbon($return['next_expected_match']); - $return['next_expected_match_diff'] = $nextExpectedMatch->isToday() ? trans('firefly.today') : $nextExpectedMatch->diffForHumans(today(), Carbon::DIFF_RELATIVE_TO_NOW); - $currency = $bill->transactionCurrency ?? $defaultCurrency; - $return['currency_id'] = $currency->id; - $return['currency_name'] = $currency->name; - $return['currency_symbol'] = $currency->symbol; - $return['currency_code'] = $currency->code; - $return['currency_decimal_places'] = $currency->decimal_places; - $return['attachments'] = $this->billRepository->getAttachments($bill); + $return = $transformer->transform($bill); + $nextExpectedMatch = new Carbon($return['next_expected_match']); + $return['next_expected_match_diff'] = $nextExpectedMatch->isToday() + ? trans('firefly.today') + : $nextExpectedMatch->diffForHumans( + today(), Carbon::DIFF_RELATIVE_TO_NOW + ); + $currency = $bill->transactionCurrency ?? $defaultCurrency; + $return['currency_id'] = $currency->id; + $return['currency_name'] = $currency->name; + $return['currency_symbol'] = $currency->symbol; + $return['currency_code'] = $currency->code; + $return['currency_decimal_places'] = $currency->decimal_places; + $return['attachments'] = $this->billRepository->getAttachments($bill); return $return; } diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php index 637d68e2b0..74e548e7c7 100644 --- a/app/Models/TransactionJournal.php +++ b/app/Models/TransactionJournal.php @@ -121,18 +121,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; * @property-read int|null $transaction_journal_meta_count * @property-read int|null $transactions_count * @method static EloquentBuilder|TransactionJournal whereTransactionGroupId($value) - * @property int $user_id - * @property int|null $transaction_group_id - * @property int|null $transaction_currency_id - * @property \Illuminate\Support\Carbon|null $interest_date - * @property \Illuminate\Support\Carbon|null $book_date - * @property \Illuminate\Support\Carbon|null $process_date - * @property int $order - * @property bool $encrypted - * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Budget[] $budgets - * @property-read \FireflyIII\Models\TransactionGroup|null $transactionGroup - * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournalMeta[] $transactionJournalMeta - * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions */ class TransactionJournal extends Model {