@@ -482,7 +482,10 @@ instance ToJSON ZonedTime where
482482 | otherwise = "%z"
483483
484484formatMillis :: (FormatTime t) => t -> String
485−formatMillis t = take 3 . formatTime defaultTimeLocale "%q" $ t
485+formatMillis = take 3 . formatSubseconds
486+
487+formatSubseconds :: (FormatTime t) => t -> String
488+formatSubseconds = formatTime defaultTimeLocale "%q"
486489
487490instance FromJSON ZonedTime where
488491 parseJSON (String t) =
@@ -508,7 +511,7 @@ instance FromJSON ZonedTime where
508511instance ToJSON UTCTime where
509512 toJSON t = String $ pack $ formatTime defaultTimeLocale format t
510513 where
511− format = "%FT%T." ++ formatMillis t ++ "Z"
514+ format = "%FT%T." ++ formatSubseconds t ++ "Z"
512515 {-# INLINE toJSON #-}
513516
514517instance FromJSON UTCTime where