diff --git a/src/Api/MergeRequests.php b/src/Api/MergeRequests.php index ed3779f6..2bb8584a 100644 --- a/src/Api/MergeRequests.php +++ b/src/Api/MergeRequests.php @@ -74,7 +74,9 @@ public function all($project_id = null, array $parameters = []) { $resolver = $this->createOptionsResolver(); $datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string { - return $value->format('c'); + $utc = (new \DateTimeImmutable($value->format(\DateTimeImmutable::RFC3339_EXTENDED)))->setTimezone(new \DateTimeZone('UTC')); + + return $utc->format('Y-m-d\TH:i:s.v\Z'); }; $resolver->setDefined('iids') ->setAllowedTypes('iids', 'array') diff --git a/tests/Api/MergeRequestsTest.php b/tests/Api/MergeRequestsTest.php index ae8225bc..227b89a0 100644 --- a/tests/Api/MergeRequestsTest.php +++ b/tests/Api/MergeRequestsTest.php @@ -107,11 +107,11 @@ public function shouldGetAllWithDateTimeParams(): void $expectedArray = $this->getMultipleMergeRequestsData(); $createdAfter = new \DateTime('2018-01-01 00:00:00'); - $createdBefore = new \DateTime('2018-01-31 00:00:00'); + $createdBefore = new \DateTime('2018-01-31 12:00:00.123+03:00'); $expectedWithArray = [ - 'created_after' => $createdAfter->format(\DATE_ATOM), - 'created_before' => $createdBefore->format(\DATE_ATOM), + 'created_after' => '2018-01-01T00:00:00.000Z', + 'created_before' => '2018-01-31T09:00:00.123Z', ]; $api = $this->getApiMock();