-- 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:
--
--
-- - DD.MM.YYYY
-- - YYYY/MM/DD
-- - `12 September 2012'
-- - today, tomorrow, yesterday
-- - `in 2 days', '3 weeks ago'
-- - `last monday', 'next friday'
-- - `last month' (1th of this month), `next year' (1th of January of
-- next year)
--
--
-- 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.1.2
module Data.Dates.Internal
-- | Parser version of Prelude.read
tryRead :: Read a => String -> Parsec String st a
tryReadInt :: Num a => String -> Parsec String st a
-- | Apply parser N times
times :: Int -> Parsec String st t -> Parsec String st [t]
-- | Parse natural number of N digits which is not greater than M
number :: Int -> Int -> Parsec String st Int
pYear :: Parsec String st Int
pMonth :: Parsec String st Int
pDay :: Parsec String st 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 :: Int -> FormatElement
MONTH :: Int -> FormatElement
DAY :: Int -> FormatElement
HOUR :: Int -> FormatElement
MINUTE :: Int -> FormatElement
SECOND :: Int -> FormatElement
Fixed :: String -> FormatElement
-- | Date/time format
type Format = [FormatElement]
-- | Parser for date/time format.
pFormat :: Parsec String st Format
-- | Make Parser for specified date format.
formatParser :: Format -> Parsec String st 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 :: DateTime -> Parsec String st DateTime
-- | Parsec parser for DateTime.
pDateTime :: DateTime -> Parsec String st DateTime
pTime :: Parsec String st Time
pDateInterval :: Parsec String st DateInterval
-- | Get current date and time.
getCurrentDateTime :: IO DateTime
-- | Parser version of Prelude.read
tryRead :: Read a => String -> Parsec String st a
tryReadInt :: Num a => String -> Parsec String st 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