@@ -177,11 +177,18 @@ instance Result [Char] where
177 convert f dat = ST.unpack <$> convert f dat
177 convert f dat = ST.unpack <$> convert f dat
179instance Result UTCTime where
179instance Result UTCTime where
180− convert f = doConvert f ok $ \bs ->
180+ convert f =
181− case parseTime defaultTimeLocale "%F %T%Q%z" (B8.unpack bs ++ "00") of
181+ case oid2builtin (typeOid f) of
182+ Just Timestamp -> doIt "%F %T%Q" id
183+ Just TimestampWithTimeZone -> doIt "%F %T%Q%z" (++ "00")
184+ _ -> const $ returnError Incompatible f "types incompatible"
186+ doIt _ _ Nothing = returnError UnexpectedNull f ""
187+ doIt fmt preprocess (Just bs) =
188+ case parseTime defaultTimeLocale fmt str of
182− Just t -> Right t
189+ Just t -> Right t
183− Nothing -> returnError ConversionFailed f "could not parse"
190+ Nothing -> returnError ConversionFailed f "could not parse"
184− where ok = mkCompats [TimestampWithTimeZone]
191+ where str = preprocess (B8.unpack bs)
186instance Result Day where
193instance Result Day where
187 convert f = atto ok date f
194 convert f = atto ok date f