Skip to content

Firefly III: a personal finances manager

Fix #10815

James Cole1cde7aab0c87
diff --git a/app/Support/JsonApi/Enrichments/AccountEnrichment.php b/app/Support/JsonApi/Enrichments/AccountEnrichment.php
index 80cfe8fc97..58df9f7e9a 100644
--- a/app/Support/JsonApi/Enrichments/AccountEnrichment.php
+++ b/app/Support/JsonApi/Enrichments/AccountEnrichment.php
@@ -327,6 +327,7 @@ class AccountEnrichment implements EnrichmentInterface
$openingBalance = null;
$pcOpeningBalance = null;
}
+ $meta['current_balance_date'] =$this->getDate();
$meta['balances'] = [
'current_balance' => $currentBalance,
'pc_current_balance' => $pcCurrentBalance,
@@ -378,13 +379,17 @@ class AccountEnrichment implements EnrichmentInterface
public function setDate(?Carbon $date): void
{
+ if(null !== $date) {
+ $date->endOfDay();
+ Log::debug(sprintf('Date is now %s', $date->toW3cString()));
+ }
$this->date = $date;
}
public function getDate(): Carbon
{
if (null === $this->date) {
- return today();
+ return now();
}
return $this->date;
diff --git a/app/Transformers/AccountTransformer.php b/app/Transformers/AccountTransformer.php
index 1f8ff4dadc..0ef5046eb6 100644
--- a/app/Transformers/AccountTransformer.php
+++ b/app/Transformers/AccountTransformer.php
@@ -78,10 +78,6 @@ class AccountTransformer extends AbstractTransformer
$zoomLevel = $account->meta['location']['zoom_level'] ?? null;
$order = $account->order;
- // date (for balance etc.)
- $date = $this->getDate();
- $date->endOfDay();
-
// get primary currency as fallback:
$currency = $this->primary; // assume primary currency
if ($hasCurrencySettings) {
@@ -141,7 +137,7 @@ class AccountTransformer extends AbstractTransformer
'debt_amount' => $account->meta['balances']['debt_amount'],
'pc_debt_amount' => $account->meta['balances']['pc_debt_amount'],
- 'current_balance_date' => $date->toAtomString(),
+ 'current_balance_date' => $account->meta['current_balance_date']->toAtomString(),
'notes' => $account->meta['notes'] ?? null,
'monthly_payment_date' => $monthlyPaymentDate,
'credit_card_type' => $creditCardType,