Skip to content

Commit

Permalink
Fix tests timezone-related issues. (#713)
Browse files Browse the repository at this point in the history
Enforce UTC timezone for GrpcTrait::formatTimestampForApi().
  • Loading branch information
vam-google authored and dwsupplee committed Oct 25, 2017
1 parent 13cd745 commit d728f8e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion GrpcTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ private function formatTimestampForApi($value)
{
preg_match('/\.(\d{1,9})Z/', $value, $matches);
$value = preg_replace('/\.(\d{1,9})Z/', '.000000Z', $value);
$dt = \DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.u\Z', $value);
$dt = \DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.u\Z', $value, new \DateTimeZone('UTC'));
$nanos = (isset($matches[1])) ? str_pad($matches[1], 9, '0') : 0;

return [
Expand Down

0 comments on commit d728f8e

Please sign in to comment.