timeparsers-0.3.2: Attoparsec parsers for various Date/Time formats.

Safe HaskellNone

Data.Time.Parsers.Util

Synopsis

Documentation

nDigit :: (Read a, Num a) => Int -> Parser aSource

Parse a given number of digits

isBCE :: OptionedParser BoolSource

Return true if the strings BC or BCE are consumed, false otherwise

onlyParse :: OptionedParser a -> OptionedParser aSource

Fail if the given parser fails to consume all of the input

defaultOptions :: OptionsSource

Default Options to use: Try YMD, then MDY, then DMY Accept ., ' ', /, - as separators. Use flags MakeRecent, DefaultToUTC, DefaultToMidnight

parseWithOptions :: Options -> OptionedParser a -> ByteString -> Result aSource

Use given options and parser to parse a single Timestamp. always feeds empty, so a Partial result is never returned. Ignores preceding and trailing whitespace.

parseWithDefaultOptions :: OptionedParser a -> ByteString -> Result aSource

Use default options to parse single Timestamp with a given parser, ignoring preceding and trailing whitespace

isFlagSet :: Flag -> OptionedParser BoolSource

Return whether a given flag is set.

makeBCE :: Monad m => Day -> m DaySource

Converts a CE date into a BCE date. Fails if the date is already BCE Warning: If you anticipate BCE dates, it is advisable to not use the MakeRecent flag. It will cause ByteStrings such as 79 BC to be parsed as 1979 BCE

fromExtendedTimestamp :: (FromZonedTime a, ToZonedTime a) => a -> ExtendedTimestamp a -> aSource

Given a timestamp to use as the current time, purely convert an ExtendedTimestamp to a timestamp

fromExtendedTimestampIO :: (FromZonedTime a, ToZonedTime a) => ExtendedTimestamp a -> IO aSource

Use getZonedTime to get the current time, and use it to convert an ExtendedTimestamp to a timestamp