Soap response:
'requestDate' => '2019-08-31+02:00',
means you got Y-m-dP
P
Difference to Greenwich time (GMT) with colon between hours and minutes (added in PHP 5.1.3)
Example: +02:00
see https://www.php.net/manual/de/function.date.php
You are currenty using Y-m-d\+H:i
which set it to 2am always :)
So in example:
response:
'requestDate' => '2019-08-31+02:00',
current code:
date_create_from_format('Y-m-d\+H:i', $response->requestDate)
returns:
DateTime::__set_state(array(
'date' => '2019-08-31 02:00:00.000000',
'timezone_type' => 3,
'timezone' => 'UTC',
))
should use:
date_create_from_format('Y-m-dP', $response->requestDate)
BUT
this would automatically add current time due to the api does not provide time.
So a solution would be (since we get no time) to set the time to zero.
$datetime = date_create_from_format('Y-m-dP', $response->requestDate);
$datetime->setTime(0, 0, 0, 0);
DateTime::__set_state(array(
'date' => '2019-08-31 00:00:00.000000',
'timezone_type' => 1,
'timezone' => '+02:00',
))
PR: #69
EDIT: the warning in te main readme should be removed.
WARNING: VIES service returns invalid time, use your own time setting!
PR: #71
EDIT: i just saw you have the format already implemented but not used anywhere:
\DragonBe\Vies\CheckVatResponse::VIES_DATETIME_FORMAT
public const VIES_DATETIME_FORMAT = 'Y-m-dP';
gonna change that ...