Skip to content

Commit 06ec4c6

Browse files
committed
AC-14431: Order items order_date wrong formatting
1 parent b30aac8 commit 06ec4c6

File tree

6 files changed

+8
-5
lines changed

6 files changed

+8
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function format(OrderInterface $orderModel): array
4949
'increment_id' => $orderModel->getIncrementId(),
5050
'number' => $orderModel->getIncrementId(),
5151
'order_date' => $this->timezone->date($orderModel->getCreatedAt())
52-
->format('d/m/Y H:i:s'),
52+
->format(DateTime::DATETIME_SLASH_PHP_FORMAT),
5353
'order_number' => $orderModel->getIncrementId(),
5454
'status' => $orderModel->getStatusLabel(),
5555
'email' => $orderModel->getCustomerEmail(),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function resolve(
5353
$comments[] = [
5454
'message' => $comment->getComment(),
5555
'timestamp' => $this->timezone->date($comment->getCreatedAt())
56-
->format(DateTime::DATETIME_PHP_FORMAT)
56+
->format(DateTime::DATETIME_SLASH_PHP_FORMAT)
5757
];
5858
}
5959
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private function getInvoiceComments(InvoiceInterface $invoice): array
7474
if ($comment->getIsVisibleOnFront()) {
7575
$comments[] = [
7676
'timestamp' => $this->timezone->date($comment->getCreatedAt())
77-
->format(DateTime::DATETIME_PHP_FORMAT),
77+
->format(DateTime::DATETIME_SLASH_PHP_FORMAT),
7878
'message' => $comment->getComment()
7979
];
8080
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private function getShipmentComments(ShipmentInterface $shipment): array
7575
if ($comment->getIsVisibleOnFront()) {
7676
$comments[] = [
7777
'timestamp' => $this->timezone->date($comment->getCreatedAt())
78-
->format(DateTime::DATETIME_PHP_FORMAT),
78+
->format(DateTime::DATETIME_SLASH_PHP_FORMAT),
7979
'message' => $comment->getComment()
8080
];
8181
}

dev/tests/api-functional/testsuite/Magento/GraphQl/Sales/RetrieveOrdersByOrderNumberTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Framework\Api\SearchCriteriaBuilder;
1212
use Magento\Framework\Exception\AuthenticationException;
1313
use Magento\Framework\Registry;
14+
use Magento\Framework\Stdlib\DateTime;
1415
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
1516
use Magento\GraphQl\GetCustomerAuthenticationHeader;
1617
use Magento\Sales\Api\OrderRepositoryInterface;
@@ -508,7 +509,7 @@ public function testGetCustomerDescendingSortedOrders()
508509
for ($i = 1; $i <= 3; $i++) {
509510
$orderNumber = $this->fixtures->get('or' . $i)->getIncrementId();
510511
$orderCreatedAt = $this->timezone->date($this->fixtures->get('or' . $i)->getCreatedAt())
511-
->format('d/m/Y H:i:s');
512+
->format(DateTime::DATETIME_SLASH_PHP_FORMAT);
512513
$orderNumberCreatedAtExpected[$orderNumber] = $orderCreatedAt;
513514
}
514515

lib/internal/Magento/Framework/Stdlib/DateTime.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ class DateTime
2525

2626
public const DATE_PHP_FORMAT = 'Y-m-d';
2727

28+
public const DATETIME_SLASH_PHP_FORMAT = 'd/m/Y H:i:s';
29+
2830
/**#@-*/
2931

3032
/**

0 commit comments

Comments
 (0)