Skip to content

Commit

Permalink
[BOL-254] Convert timestamp to ISO 8601 in shipment handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeroen van Leusden committed Jan 28, 2020
1 parent e596c4c commit b40c25c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Handler/Shipment/GetShipmentHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public function __invoke(GetShipment $getShipment): Shipment
]);

$response = $response->getBody()->json();

// Current return includes milliseconds: 2018-12-20T11:34:50.237+01:00
// Convert this timestamp into ISO 8601 format.
$response['shipmentDate'] = (new \DateTime($response['shipmentDate']))->format(\DateTime::ATOM);
$response['shipmentItems'] = array_map(static function (array $item) {
$item['latestDeliveryDate'] = (new \DateTime($item['latestDeliveryDate']))->format('Y-m-d');

Expand Down

0 comments on commit b40c25c

Please sign in to comment.