Commits

Anonymous committed a1e0dd9

Added default time format that wasn't tried when parsing.

  • Participants
  • Parent commits b7285aa

Comments (0)

Files changed (1)

File Data/Aeson/Types/Class.hs

 import Data.Vector (Vector)
 import Data.Word (Word, Word8, Word16, Word32, Word64)
 import Foreign.Storable (Storable)
-import System.Locale (defaultTimeLocale)
+import System.Locale (defaultTimeLocale, dateTimeFmt)
 import qualified Data.ByteString as B
 import qualified Data.ByteString.Lazy as LB
 import qualified Data.HashMap.Strict as H
 
 instance FromJSON ZonedTime where
     parseJSON (String t) =
-      tryFormats alternateFormats
+      tryFormats (defaultFormat : alternateFormats)
       <|> fail "could not parse ECMA-262 ISO-8601 date"
       where
+        defaultFormat = dateTimeFmt defaultTimeLocale
         tryFormat f =
           case parseTime defaultTimeLocale f (unpack t) of
             Just d -> pure d