From 36e87f33839afef75f469678f736869958a3b859 Mon Sep 17 00:00:00 2001 From: James Cole Date: Mon, 6 Oct 2025 20:43:47 +0200 Subject: [PATCH] Fix #11007 and fix #11005 --- app/Api/V1/Controllers/Autocomplete/AccountController.php | 2 +- app/Api/V1/Controllers/Models/Account/ShowController.php | 6 ++++++ app/Support/Request/ConvertsDataTypes.php | 3 ++- changelog.md | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/Api/V1/Controllers/Autocomplete/AccountController.php b/app/Api/V1/Controllers/Autocomplete/AccountController.php index efd12f655e..c3f7cd9618 100644 --- a/app/Api/V1/Controllers/Autocomplete/AccountController.php +++ b/app/Api/V1/Controllers/Autocomplete/AccountController.php @@ -90,7 +90,7 @@ class AccountController extends Controller $timer->start(sprintf('AC accounts "%s"', $query)); $result = $this->repository->searchAccount((string) $query, $types, $this->parameters->get('limit')); - // set date to subday + end-of-day for account balance. so it is at $date 23:59:59 + // set date to end-of-day for account balance. so it is at $date 23:59:59 $date->endOfDay(); $allBalances = Steam::accountsBalancesOptimized($result, $date, $this->primaryCurrency, $this->convertToPrimary); diff --git a/app/Api/V1/Controllers/Models/Account/ShowController.php b/app/Api/V1/Controllers/Models/Account/ShowController.php index 230246bcf1..33c2e100d1 100644 --- a/app/Api/V1/Controllers/Models/Account/ShowController.php +++ b/app/Api/V1/Controllers/Models/Account/ShowController.php @@ -87,6 +87,9 @@ class ShowController extends Controller // TODO still need to figure out how to do this easily. $accounts = $collection->slice(($this->parameters->get('page') - 1) * $params['limit'], $params['limit']); + // #11007 go to the end of the previous day. + $this->parameters->set('start', $this->parameters->get('start')->subSecond()); + // enrich /** @var User $admin */ $admin = auth()->user(); @@ -125,6 +128,9 @@ class ShowController extends Controller $account->refresh(); $manager = $this->getManager(); + // #11007 go to the end of the previous day. + $this->parameters->set('start', $this->parameters->get('start')->subSecond()); + // enrich /** @var User $admin */ $admin = auth()->user(); diff --git a/app/Support/Request/ConvertsDataTypes.php b/app/Support/Request/ConvertsDataTypes.php index 5293a6f804..a57c45a320 100644 --- a/app/Support/Request/ConvertsDataTypes.php +++ b/app/Support/Request/ConvertsDataTypes.php @@ -314,7 +314,8 @@ trait ConvertsDataTypes // is an atom string, I hope? try { - $carbon = Carbon::parse($value, $value, config('app.timezone')); + $carbon = Carbon::parse($value); + $carbon->setTimezone(config('app.timezone')); } catch (InvalidDateException $e) { // @phpstan-ignore-line Log::error(sprintf('[3] "%s" is not a valid date or time: %s', $value, $e->getMessage())); diff --git a/changelog.md b/changelog.md index 588034223d..acd62c1168 100644 --- a/changelog.md +++ b/changelog.md @@ -29,6 +29,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). - [Discussion 10988](https://github.com/orgs/firefly-iii/discussions/10988) (Call to a member function startOfDay() on null.) started by @molnarti - [Issue 10990](https://github.com/firefly-iii/firefly-iii/issues/10990) (duplicate piggy event via API) reported by @4e868df3 - [Discussion 10994](https://github.com/orgs/firefly-iii/discussions/10994) (How does the save per month attribute from a piggy bank is calculated?) started by @AdriDevelopsThings +- #11005 +- #11007 ### API