Skip to content

Commit 05a1a73

Browse files
committed
Fix formatting for PersistField
1 parent 0e34ba9 commit 05a1a73

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

persistent/Database/Persist/Class/PersistField.hs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,6 @@ instance PersistField UTCTime where
322322
-- precision parsed as posssible.
323323
Right $ fst $ NonEmpty.last matches
324324
where
325-
#if MIN_VERSION_time(1,5,0)
326-
parseTime' = parseTimeM True defaultTimeLocale
327-
#else
328-
parseTime' = parseTime defaultTimeLocale
329-
#endif
330325
parse8601 = parseTime' "%FT%T%Q"
331326
parsePretty = parseTime' "%F %T%Q"
332327
fromPersistValue x@(PersistByteString s) =
@@ -336,6 +331,14 @@ instance PersistField UTCTime where
336331

337332
fromPersistValue x = Left $ fromPersistValueError "UTCTime" "time, integer, string, or bytestring" x
338333

334+
#if MIN_VERSION_time(1,5,0)
335+
parseTime' :: String -> Maybe UTCTime
336+
parseTime' = parseTimeM True defaultTimeLocale
337+
#else
338+
parseTime' :: String -> Maybe UTCTime
339+
parseTime' = parseTime defaultTimeLocale
340+
#endif
341+
339342
-- | Prior to @persistent-2.11.0@, we provided an instance of
340343
-- 'PersistField' for the 'Natural' type. This was in error, because
341344
-- 'Natural' represents an infinite value, and databases don't have

0 commit comments

Comments
 (0)