on master help sign in
Merge pull request #200 from liyang/master

Data.Aeson.Types.Instances: fix UTCTime for years outside of [0, 9999]

commit0dcdd727392ace6a3a672dd36a893c76c3ae8dc3 authorBryan O'Sullivan <bos@serpentine.com> dateWed 2 Jul 2014, 12:16 (12 years ago) parent84ae2a9a6e8a3a
1 file changed+3−2
Data/Aeson/Types/Instances.hs+3−2
Data/Aeson/Types/Instances.hs+3−2
@@ -497,8 +497,9 @@ instance FromJSON ZonedTime where
497497 parseJSON v = typeMismatch "ZonedTime" v
498498
499499instance ToJSON UTCTime where
500− toJSON t = String (pack (take 23 str ++ "Z"))
501− where str = formatTime defaultTimeLocale "%FT%T.%q" t
500+ toJSON t = String $ pack $ formatTime defaultTimeLocale format t
501+ where
502+ format = "%FT%T." ++ formatMillis t ++ "Z"
502503 {-# INLINE toJSON #-}
503504
504505instance FromJSON UTCTime where