Skip to content

Commit

Permalink
Merge pull request #200 from liyang/master
Browse files Browse the repository at this point in the history
Data.Aeson.Types.Instances: fix UTCTime for years outside of [0, 9999]
  • Loading branch information
bos committed Jul 2, 2014
2 parents a6f3870 + 4bee2d4 commit 49a13d2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Data/Aeson/Types/Instances.hs
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,9 @@ instance FromJSON ZonedTime where
parseJSON v = typeMismatch "ZonedTime" v

instance ToJSON UTCTime where
toJSON t = String (pack (take 23 str ++ "Z"))
where str = formatTime defaultTimeLocale "%FT%T.%q" t
toJSON t = String $ pack $ formatTime defaultTimeLocale format t
where
format = "%FT%T." ++ formatMillis t ++ "Z"
{-# INLINE toJSON #-}

instance FromJSON UTCTime where
Expand Down

0 comments on commit 49a13d2

Please sign in to comment.