Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type Period = (Day, Day)
- data PeriodFmt = PeriodFmt {
- perFieldSep :: Text
- perDateSep :: Text
- parsePeriod :: Text -> Period
- parsePeriodMay :: Text -> Maybe Period
- parsePeriodEither :: Text -> Either String Period
- formatPeriod :: PeriodFmt -> Period -> Text
- collapsePeriod :: PeriodFmt -> Period -> Text
Documentation
PeriodFmt | |
|
parsePeriod :: Text -> Period Source #
Parse period from text representation, which can be either simple date
range (yyyy-mm-dd,yyyy-mm-dd
) or something shorter like yyyy,yyyy
, or even
something like yyyy-01-23,03-21
which corresponds to
yyyy-01-23,yyyy-03-21
. The list of possible combinations can be found in
test/Spec.hs
.
parsePeriod
understands dash as field separator (like yyyy-mm-dd
), or
accepts short date format (yyyymmdd
). It
understands comma and underscore as separators between
dashed dates (yyyy-mm-dd
) and dash as separator between short dates (yyyymmdd
).
parsePeriod
produces error on unparsable input.
parsePeriodMay :: Text -> Maybe Period Source #
Safe analogue of parsePeriod
using Maybe
parsePeriodEither :: Text -> Either String Period Source #
Safe analogue of parsePeriod
using Either