This commit is contained in:
James Cole
2023-05-17 07:02:08 +02:00
parent 3c082dcf0e
commit 63984f1c37
14 changed files with 68 additions and 21 deletions

View File

@@ -209,7 +209,13 @@ class AccountTransformer extends AbstractTransformer
$monthlyPaymentDate = $this->repository->getMetaValue($account, 'cc_monthly_payment_date');
}
if (null !== $monthlyPaymentDate) {
$monthlyPaymentDate = Carbon::createFromFormat('!Y-m-d', $monthlyPaymentDate, config('app.timezone'))->toAtomString();
// try classic date:
if(10 === strlen($monthlyPaymentDate)) {
$monthlyPaymentDate = Carbon::createFromFormat('!Y-m-d', $monthlyPaymentDate, config('app.timezone'))->toAtomString();
}
if(10 !== strlen($monthlyPaymentDate)) {
$monthlyPaymentDate = Carbon::parse($monthlyPaymentDate, config('app.timezone'))->toAtomString();
}
}
return [$creditCardType, $monthlyPaymentDate];
@@ -233,7 +239,7 @@ class AccountTransformer extends AbstractTransformer
$openingBalanceDate = $this->repository->getOpeningBalanceDate($account);
}
if (null !== $openingBalanceDate) {
$openingBalanceDate = Carbon::createFromFormat('!Y-m-d', $openingBalanceDate, config('app.timezone'))->toAtomString();
$openingBalanceDate = Carbon::createFromFormat('Y-m-d H:i:s', $openingBalanceDate, config('app.timezone'))->toAtomString();
}
return [$openingBalance, $openingBalanceDate];

View File

@@ -103,9 +103,8 @@ class PiggyBankTransformer extends AbstractTransformer
$leftToSave = app('steam')->bcround($leftToSave, $currency->decimal_places);
$savePerMonth = app('steam')->bcround($this->piggyRepos->getSuggestedMonthlyAmount($piggyBank), $currency->decimal_places);
}
$startDate = $piggyBank->startdate?->toAtomString();
$targetDate = $piggyBank->targetdate?->toAtomString();
$startDate = $piggyBank->startdate?->format('Y-m-d');
$targetDate = $piggyBank->targetdate?->format('Y-m-d');
return [
'id' => (string)$piggyBank->id,

View File

@@ -92,9 +92,9 @@ class RecurrenceTransformer extends AbstractTransformer
'type' => $shortType,
'title' => $recurrence->title,
'description' => $recurrence->description,
'first_date' => $recurrence->first_date->toAtomString(),
'latest_date' => $recurrence->latest_date?->toAtomString(),
'repeat_until' => $recurrence->repeat_until?->toAtomString(),
'first_date' => $recurrence->first_date->format('Y-m-d'),
'latest_date' => $recurrence->latest_date?->format('Y-m-d'),
'repeat_until' => $recurrence->repeat_until?->format('Y-m-d'),
'apply_rules' => $recurrence->apply_rules,
'active' => $recurrence->active,
'nr_of_repetitions' => $reps,

View File

@@ -42,7 +42,7 @@ class TagTransformer extends AbstractTransformer
*/
public function transform(Tag $tag): array
{
$date = $tag->date?->toAtomString();
$date = $tag->date?->format('Y-m-d');
/** @var Location $location */
$location = $tag->locations()->first();
$latitude = null;