We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a4e4cab + 556c1f1 commit afd3673Copy full SHA for afd3673
attoparsec-iso8601/Data/Attoparsec/Time.hs
@@ -42,9 +42,9 @@ import qualified Data.Time.LocalTime as Local
42
day :: Parser Day
43
day = do
44
absOrNeg <- negate <$ char '-' <|> id <$ char '+' <|> pure id
45
- y <- decimal <* char '-'
46
- m <- twoDigits <* char '-'
47
- d <- twoDigits
+ y <- (decimal <* char '-') <|> fail "date must be of form [+,-]YYYY-MM-DD"
+ m <- (twoDigits <* char '-') <|> fail "date must be of form [+,-]YYYY-MM-DD"
+ d <- twoDigits <|> fail "date must be of form [+,-]YYYY-MM-DD"
48
maybe (fail "invalid date") return (fromGregorianValid (absOrNeg y) m d)
49
50
-- | Parse a two-digit integer (e.g. day of month, hour).
0 commit comments