This commit is contained in:
James Cole
2025-08-24 20:14:02 +02:00
parent 2d67eece5d
commit 1cde7aab0c
2 changed files with 7 additions and 6 deletions

View File

@@ -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;

View File

@@ -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,