Преглед изворни кода

Only use DateTimeImmutable formatting for default date format, fixes #827

Jordi Boggiano пре 9 година
родитељ
комит
5967b80dfb
1 измењених фајлова са 3 додато и 1 уклоњено
  1. 3 1
      src/Monolog/Formatter/NormalizerFormatter.php

+ 3 - 1
src/Monolog/Formatter/NormalizerFormatter.php

@@ -300,7 +300,9 @@ class NormalizerFormatter implements FormatterInterface
 
     protected function formatDate(\DateTimeInterface $date)
     {
-        if ($date instanceof DateTimeImmutable) {
+        // in case the date format isn't custom then we defer to the custom DateTimeImmutable
+        // formatting logic, which will pick the right format based on whether useMicroseconds is on
+        if ($this->dateFormat === self::SIMPLE_DATE && $date instanceof DateTimeImmutable) {
             return (string) $date;
         }