attoparsec-time 1.0.2 → 1.0.3
raw patch · 2 files changed
+30/−2 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Attoparsec.Time.Text: timeOfDayInDashes :: Parser TimeOfDay
+ Attoparsec.Time.Text: utcTimeInDashes :: Parser UTCTime
Files
- attoparsec-time.cabal +1/−1
- library/Attoparsec/Time/Text.hs +29/−1
attoparsec-time.cabal view
@@ -1,5 +1,5 @@ name: attoparsec-time-version: 1.0.2+version: 1.0.3 synopsis: Attoparsec parsers of time description: A collection of Attoparsec parsers for the \"time\" library category: Attoparsec, Parsers, Time
library/Attoparsec/Time/Text.hs view
@@ -1,10 +1,12 @@ module Attoparsec.Time.Text ( timeOfDayInISO8601,+ timeOfDayInDashes, dayInISO8601, yearAndMonthInISO8601, timeZoneInISO8601, utcTimeInISO8601,+ utcTimeInDashes, diffTime, nominalDiffTime, -- *@@ -68,7 +70,7 @@ beforePoint = replicateM basisLength decimalChar afterPoint =- padListFromRight 0 [] resolution <$> ((char '.' *> many decimalChar) <|> pure [])+ padListFromRight 0 [] resolution <$> ((char '.' *> many1 decimalChar) <|> pure []) where padListFromRight padding accumulator length list = case length of@@ -129,6 +131,17 @@ (minute <* char ':') <*> (second) +{-# INLINE timeOfDayInDashes #-}+timeOfDayInDashes :: Parser TimeOfDay+timeOfDayInDashes =+ unnamedParser <?> "timeOfDayInDashes"+ where+ unnamedParser =+ A.timeOfDay <$>+ (hour <* char '-') <*>+ (minute <* char '-') <*>+ (second)+ {-| >>> parseOnly dayInISO8601 "2017-02-01" Right 2017-02-01@@ -221,6 +234,21 @@ time <- timeOfDayInISO8601 zone <- timeZoneInISO8601 return (A.utcTimeFromDayAndTimeOfDay day time zone)++{-|+>>> parseOnly utcTimeInDashes "2017-02-01-05-03-58"+Right 2017-02-01 05:03:58 UTC+-}+utcTimeInDashes :: Parser UTCTime+utcTimeInDashes =+ unnamedParser <?> "utcTimeInDashes"+ where+ unnamedParser =+ do+ day <- dayInISO8601+ char '-'+ time <- timeOfDayInDashes+ return (localTimeToUTC utc (LocalTime day time)) {-| No suffix implies the "seconds" unit: