Safe Haskell | None |
---|---|
Language | Haskell2010 |
Parse strings that aren't so precise
- data Config = Config {}
- data DateTime :: * = DateTime {}
- data DateInterval
- class Timeable t => Time t where
- defaultConfig :: DateTime -> Config
- defaultConfigIO :: IO Config
- parseDate :: Config -> String -> Either ParseError Date
- parseDateTime :: Config -> String -> Either ParseError DateTime
- pAbsDateTime :: Stream s m Char => Int -> ParsecT s st m DateTime
- pAbsDate :: Stream s m Char => Int -> ParsecT s st m Date
- pDate :: Stream s m Char => Config -> ParsecT s st m Date
- pDateTime :: Stream s m Char => Config -> ParsecT s st m DateTime
- pTime :: Stream s m Char => ParsecT s st m TimeOfDay
- pDateInterval :: Stream s m Char => ParsecT s st m DateInterval
- weekdayToInterval :: Config -> WeekDay -> DateInterval
- dateWeekDay :: DateTime -> WeekDay
- getStartOfThisWeek :: Config -> DateTime
- getStartOfNextWeek :: Config -> DateTime
- lastDate :: Stream s m Char => Config -> ParsecT s st m DateTime
- nextDate :: Stream s m Char => Config -> ParsecT s st m DateTime
- addInterval :: DateTime -> DateInterval -> DateTime
- negateInterval :: DateInterval -> DateInterval
- minusInterval :: DateTime -> DateInterval -> DateTime
- dateInFormat :: Stream s m Char => Int -> DateFormat -> ParsecT s st m Date
- extractDates :: String -> IO [Date]
- extractDatesY :: Int -> String -> [Date]
- extract :: Stream s m Char => ParsecT s st m a -> ParsecT s st m [a]
Documentation
Date and Time
data DateInterval Source #
class Timeable t => Time t where #
Represent time types that can be created from other time types.
Every conversion happens throught ElapsedP or Elapsed types.
timeFromElapsedP :: ElapsedP -> t #
convert from a number of elapsed seconds and nanoseconds to another time representation
timeFromElapsed :: Elapsed -> t #
convert from a number of elapsed seconds and nanoseconds to another time representation
defaults to timeFromElapsedP unless defined explicitely by an instance.
defaultConfig :: DateTime -> Config Source #
:: Config | |
-> String | String to parse |
-> Either ParseError DateTime |
Parse date/time
pDateTime :: Stream s m Char => Config -> ParsecT s st m DateTime Source #
Parsec parser for DateTime.
pDateInterval :: Stream s m Char => ParsecT s st m DateInterval Source #
weekdayToInterval :: Config -> WeekDay -> DateInterval Source #
Weekday as interval from the configure start of the week
dateWeekDay :: DateTime -> WeekDay Source #
Get weekday of given date.
getStartOfThisWeek :: Config -> DateTime Source #
getStartOfNextWeek :: Config -> DateTime Source #
addInterval :: DateTime -> DateInterval -> DateTime Source #
Add date interval to DateTime
negateInterval :: DateInterval -> DateInterval Source #
Negate DateInterval value: Days 3 -> Days (-3).
minusInterval :: DateTime -> DateInterval -> DateTime Source #
Subtract DateInterval from DateTime.
extractDates :: String -> IO [Date] Source #
Same as extractDatesY, but will get the current year from the system, so you don't have to provide it.