-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Small library for parsing different dates formats. -- -- This package allows to parse many different formats of dates. Both -- absolute and relative dates are supported. Supported date formats are: -- -- -- -- 4-digits years may be abbreviated (such as 12 for 2012). Both 12-hour -- and 24-hour time formats are supported. -- -- User-specified date formats are supported by Data.Dates.Formats -- module. @package dates @version 0.2.2.0 module Data.Dates.Internal -- | Parser version of Prelude.read tryRead :: (Read a, Stream s m Char) => String -> ParsecT s st m a tryReadInt :: (Stream s m Char, Num a) => String -> ParsecT s st m a -- | Apply parser N times times :: Stream s m Char => Int -> ParsecT s st m t -> ParsecT s st m [t] -- | Parse natural number of N digits which is not greater than M number :: Stream s m Char => Int -> Int -> ParsecT s st m Int pYear :: Stream s m Char => ParsecT s st m Int pMonth :: Stream s m Char => ParsecT s st m Int pDay :: Stream s m Char => ParsecT s st m Int module Data.Dates.Types -- | Date / Time data DateTime DateTime :: Int -> Int -> Int -> Int -> Int -> Int -> DateTime year :: DateTime -> Int month :: DateTime -> Int day :: DateTime -> Int hour :: DateTime -> Int minute :: DateTime -> Int second :: DateTime -> Int -- | Only time, without date data Time Time :: Int -> Int -> Int -> Time tHour :: Time -> Int tMinute :: Time -> Int tSecond :: Time -> Int -- | 12 months names. months :: [String] -- | capitalize first letter of the string capitalize :: String -> String instance Typeable DateTime instance Typeable Time instance Eq DateTime instance Ord DateTime instance Data DateTime instance Eq Time instance Ord Time instance Show Time instance Data Time instance Monoid DateTime instance Show DateTime -- | This module allows to parse arbitrary date formats. Date formats are -- specified as strings: -- -- module Data.Dates.Formats -- | Date/time format element data FormatElement YEAR :: Bool -> Int -> FormatElement MONTH :: Bool -> Int -> FormatElement DAY :: Bool -> Int -> FormatElement HOUR :: Bool -> Int -> FormatElement MINUTE :: Bool -> Int -> FormatElement SECOND :: Bool -> Int -> FormatElement Whitespace :: Bool -> FormatElement Fixed :: Bool -> String -> FormatElement -- | Date/time format type Format = [FormatElement] type FormatParser a = Parsec String Bool a parseFormat :: String -> Either ParseError Format pFormat :: FormatParser Format -- | Make Parser for specified date format. formatParser :: Stream s m Char => Format -> ParsecT s st m DateTime -- | Parse date/time in specified format. parseDateFormat :: String -> String -> Either ParseError DateTime instance Eq FormatElement instance Show FormatElement -- | Operations with dates module Data.Dates -- | Date / Time data DateTime DateTime :: Int -> Int -> Int -> Int -> Int -> Int -> DateTime year :: DateTime -> Int month :: DateTime -> Int day :: DateTime -> Int hour :: DateTime -> Int minute :: DateTime -> Int second :: DateTime -> Int -- | Only time, without date data Time Time :: Int -> Int -> Int -> Time tHour :: Time -> Int tMinute :: Time -> Int tSecond :: Time -> Int data WeekDay Monday :: WeekDay Tuesday :: WeekDay Wednesday :: WeekDay Thursday :: WeekDay Friday :: WeekDay Saturday :: WeekDay Sunday :: WeekDay -- | Parse date/time parseDate :: DateTime -> String -> Either ParseError DateTime -- | Parsec parser for Date only. pDate :: Stream s m Char => DateTime -> ParsecT s st m DateTime -- | Parsec parser for DateTime. pDateTime :: Stream s m Char => DateTime -> ParsecT s st m DateTime pTime :: Stream s m Char => ParsecT s st m Time pDateInterval :: Stream s m Char => ParsecT s st m DateInterval -- | Get current date and time. getCurrentDateTime :: IO DateTime -- | Parser version of Prelude.read tryRead :: (Read a, Stream s m Char) => String -> ParsecT s st m a tryReadInt :: (Stream s m Char, Num a) => String -> ParsecT s st m a data DateIntervalType Day :: DateIntervalType Week :: DateIntervalType Month :: DateIntervalType Year :: DateIntervalType data DateInterval Days :: ℤ -> DateInterval Weeks :: ℤ -> DateInterval Months :: ℤ -> DateInterval Years :: ℤ -> DateInterval -- | Convert date from Day to DateTime dayToDateTime :: Day -> DateTime -- | Convert date from DateTime to Day dateTimeToDay :: DateTime -> Day -- | Weekday as interval from Monday, so that weekdayToInterval Monday == 0 -- and weekdayToInterval Sunday == 6. weekdayToInterval :: WeekDay -> DateInterval -- | Number of weekday, with Monday == 1 and Sunday == 7. weekdayNumber :: WeekDay -> Int -- | Reverse for weekdayNumber intToWeekday :: Int -> WeekDay -- | Get weekday of given date. dateWeekDay :: DateTime -> WeekDay lastMonday :: DateTime -> DateTime nextMonday :: DateTime -> DateTime -- | Modify DateTime with pure function on Day modifyDate :: (t -> Day -> Day) -> t -> DateTime -> DateTime -- | Number of days between two dates datesDifference :: DateTime -> DateTime -> Integer -- | Add date interval to DateTime addInterval :: DateTime -> DateInterval -> DateTime -- | Negate DateInterval value: Days 3 → Days (-3). negateInterval :: DateInterval -> DateInterval -- | Subtract DateInterval from DateTime. minusInterval :: DateTime -> DateInterval -> DateTime addTime :: DateTime -> Time -> DateTime instance Typeable DateIntervalType instance Typeable DateInterval instance Typeable WeekDay instance Eq DateIntervalType instance Show DateIntervalType instance Read DateIntervalType instance Data DateIntervalType instance Eq DateInterval instance Show DateInterval instance Data DateInterval instance Eq WeekDay instance Show WeekDay instance Read WeekDay instance Ord WeekDay instance Enum WeekDay instance Bounded WeekDay instance Data WeekDay