Skip to content

Commit

Permalink
UNZER-182 display charge datetime in local timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
HonkDerHase committed Aug 15, 2023
1 parent 1cac690 commit 9460df1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Controller/Admin/AdminOrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
use OxidEsales\Eshop\Application\Model\Order;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Utils;
use OxidSolutionCatalysts\Unzer\Model\Payment;
use OxidSolutionCatalysts\Unzer\Model\Order as UnzerOrder;
use OxidSolutionCatalysts\Unzer\Model\TransactionList;
Expand Down Expand Up @@ -169,7 +170,12 @@ protected function getUnzerViewData(string $sPaymentId): void
$aRv['chargeId'] = $charge->getId();
$aRv['cancellationPossible'] = $charge->getAmount() > $charge->getCancelledAmount();
$fCharged += $charge->getAmount();
$aRv['chargeDate'] = $charge->getDate();
// datetime from unzer is in GMT, convert it to local datetime
$chargeDate = $charge->getDate();
$dt = new \DateTime($chargeDate, new \DateTimeZone('GMT'));

Check failure on line 175 in src/Controller/Admin/AdminOrderController.php

View workflow job for this annotation

GitHub Actions / styles (8.0)

Parameter #1 $datetime of class DateTime constructor expects string, string|null given.
$dt->setTimezone(new \DateTimeZone(date_default_timezone_get()));
$localDate = $dt->format('Y-m-d H:i:s');
$aRv['chargeDate'] = $localDate;

$charges[] = $aRv;
}
Expand Down

0 comments on commit 9460df1

Please sign in to comment.