Skip to content

Commit 85ad2c2

Browse files
committed
Added format to order timezone dates
1 parent 20025b6 commit 85ad2c2

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

app/code/Magento/SalesGraphQl/Model/Formatter/Order.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\SalesGraphQl\Model\Formatter;
99

1010
use Magento\Framework\App\ObjectManager;
11+
use Magento\Framework\Stdlib\DateTime;
1112
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
1213
use Magento\Framework\Exception\LocalizedException;
1314
use Magento\Sales\Api\Data\OrderInterface;
@@ -49,7 +50,8 @@ public function format(OrderInterface $orderModel): array
4950
'id' => base64_encode((string)$orderModel->getEntityId()),
5051
'increment_id' => $orderModel->getIncrementId(),
5152
'number' => $orderModel->getIncrementId(),
52-
'order_date' => $this->timezone->date($orderModel->getCreatedAt()),
53+
'order_date' => $this->timezone->date($orderModel->getCreatedAt())
54+
->format(DateTime::DATETIME_PHP_FORMAT),
5355
'order_number' => $orderModel->getIncrementId(),
5456
'status' => $orderModel->getStatusLabel(),
5557
'email' => $orderModel->getCustomerEmail(),

app/code/Magento/SalesGraphQl/Model/Resolver/CreditMemo/CreditMemoComments.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\Framework\GraphQl\Config\Element\Field;
1313
use Magento\Framework\GraphQl\Query\ResolverInterface;
1414
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
15+
use Magento\Framework\Stdlib\DateTime;
1516
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
1617
use Magento\Sales\Api\Data\CreditmemoInterface;
1718

@@ -51,6 +52,7 @@ public function resolve(
5152
$comments[] = [
5253
'message' => $comment->getComment(),
5354
'timestamp' => $this->timezone->date($comment->getCreatedAt())
55+
->format(DateTime::DATETIME_PHP_FORMAT)
5456
];
5557
}
5658
}

app/code/Magento/SalesGraphQl/Model/Resolver/Invoices.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\Framework\GraphQl\Config\Element\Field;
1313
use Magento\Framework\GraphQl\Query\ResolverInterface;
1414
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
15+
use Magento\Framework\Stdlib\DateTime;
1516
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
1617
use Magento\Sales\Api\Data\OrderInterface;
1718
use Magento\Sales\Api\Data\InvoiceInterface;
@@ -71,7 +72,8 @@ private function getInvoiceComments(InvoiceInterface $invoice): array
7172
foreach ($invoice->getComments() as $comment) {
7273
if ($comment->getIsVisibleOnFront()) {
7374
$comments[] = [
74-
'timestamp' => $this->timezone->date($comment->getCreatedAt()),
75+
'timestamp' => $this->timezone->date($comment->getCreatedAt())
76+
->format(DateTime::DATETIME_PHP_FORMAT),
7577
'message' => $comment->getComment()
7678
];
7779
}

app/code/Magento/SalesGraphQl/Model/Resolver/Shipments.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\Framework\GraphQl\Config\Element\Field;
1313
use Magento\Framework\GraphQl\Query\ResolverInterface;
1414
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
15+
use Magento\Framework\Stdlib\DateTime;
1516
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
1617
use Magento\Sales\Api\Data\ShipmentInterface;
1718
use Magento\Sales\Model\Order;
@@ -72,7 +73,8 @@ private function getShipmentComments(ShipmentInterface $shipment): array
7273
foreach ($shipment->getComments() as $comment) {
7374
if ($comment->getIsVisibleOnFront()) {
7475
$comments[] = [
75-
'timestamp' => $this->timezone->date($comment->getCreatedAt()),
76+
'timestamp' => $this->timezone->date($comment->getCreatedAt())
77+
->format(DateTime::DATETIME_PHP_FORMAT),
7678
'message' => $comment->getComment()
7779
];
7880
}

0 commit comments

Comments
 (0)