Convert dates into date-times for #4571

This commit is contained in:
James Cole
2021-04-01 20:56:11 +02:00
parent f0acab21a3
commit e221d37d2b

View File

@@ -103,7 +103,7 @@ class AccountTransformer extends AbstractTransformer
'currency_symbol' => $currencySymbol, 'currency_symbol' => $currencySymbol,
'currency_decimal_places' => $decimalPlaces, 'currency_decimal_places' => $decimalPlaces,
'current_balance' => number_format((float)app('steam')->balance($account, $date), $decimalPlaces, '.', ''), 'current_balance' => number_format((float)app('steam')->balance($account, $date), $decimalPlaces, '.', ''),
'current_balance_date' => $date->format('Y-m-d'), 'current_balance_date' => $date->toAtomString(),
'notes' => $this->repository->getNoteText($account), 'notes' => $this->repository->getNoteText($account),
'monthly_payment_date' => $monthlyPaymentDate, 'monthly_payment_date' => $monthlyPaymentDate,
'credit_card_type' => $creditCardType, 'credit_card_type' => $creditCardType,
@@ -195,6 +195,9 @@ class AccountTransformer extends AbstractTransformer
$creditCardType = $this->repository->getMetaValue($account, 'cc_type'); $creditCardType = $this->repository->getMetaValue($account, 'cc_type');
$monthlyPaymentDate = $this->repository->getMetaValue($account, 'cc_monthly_payment_date'); $monthlyPaymentDate = $this->repository->getMetaValue($account, 'cc_monthly_payment_date');
} }
if(null !== $monthlyPaymentDate) {
$monthlyPaymentDate = Carbon::createFromFormat('!Y-m-d', $monthlyPaymentDate, config('app.timezone'))->toAtomString();
}
return [$creditCardType, $monthlyPaymentDate]; return [$creditCardType, $monthlyPaymentDate];
} }
@@ -218,6 +221,9 @@ class AccountTransformer extends AbstractTransformer
$openingBalance = $amount; $openingBalance = $amount;
$openingBalanceDate = $this->repository->getOpeningBalanceDate($account); $openingBalanceDate = $this->repository->getOpeningBalanceDate($account);
} }
if(null !== $openingBalanceDate) {
$openingBalanceDate = Carbon::createFromFormat('!Y-m-d', $openingBalanceDate, config('app.timezone'))->toAtomString();
}
return [$openingBalance, $openingBalanceDate]; return [$openingBalance, $openingBalanceDate];
} }