From b40c25cc20391cd5fe9ad72c407e79fa12df5352 Mon Sep 17 00:00:00 2001 From: Jeroen van Leusden Date: Tue, 28 Jan 2020 08:48:11 +0100 Subject: [PATCH] [BOL-254] Convert timestamp to ISO 8601 in shipment handler --- src/Handler/Shipment/GetShipmentHandler.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Handler/Shipment/GetShipmentHandler.php b/src/Handler/Shipment/GetShipmentHandler.php index 4c2878a..532372b 100644 --- a/src/Handler/Shipment/GetShipmentHandler.php +++ b/src/Handler/Shipment/GetShipmentHandler.php @@ -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');