Skip to content

Commit

Permalink
misc: add microseconds to datetime normalization format
Browse files Browse the repository at this point in the history
  • Loading branch information
romm committed Aug 30, 2023
1 parent 9747433 commit 0a8eab7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Normalizer/RecursiveNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private function defaultObjectNormalizer(object $object): callable
}

if ($object instanceof DateTimeInterface) {
return fn () => $object->format('Y-m-d\\TH:i:sP'); // RFC 3339
return fn () => $object->format('Y-m-d\\TH:i:s.uP'); // RFC 3339
}

if ($object::class === stdClass::class) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/Normalizer/NormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public function normalize_basic_values_yields_expected_output_data_provider(): i

yield 'date with default normalizer' => [
'input' => new DateTimeImmutable('1971-11-08'),
'expected' => '1971-11-08T00:00:00+00:00',
'expected' => '1971-11-08T00:00:00.000000+00:00',
];

yield 'date with custom normalizer' => [
Expand Down

0 comments on commit 0a8eab7

Please sign in to comment.