-- 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.3.1
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 Data.Data.Data Data.Dates.Types.DateTime
instance GHC.Classes.Ord Data.Dates.Types.DateTime
instance GHC.Classes.Eq Data.Dates.Types.DateTime
instance Data.Data.Data Data.Dates.Types.Time
instance GHC.Show.Show Data.Dates.Types.Time
instance GHC.Classes.Ord Data.Dates.Types.Time
instance GHC.Classes.Eq Data.Dates.Types.Time
instance GHC.Show.Show Data.Dates.Types.DateTime
instance GHC.Base.Semigroup Data.Dates.Types.DateTime
instance GHC.Base.Monoid Data.Dates.Types.DateTime
-- | This module allows to parse arbitrary date formats. Date formats are
-- specified as strings:
--
--
-- - DD.MM.YYY
-- - "YYYY/MM/DD"
-- - "DD/MM/YYYY, HH:mm:SS"
-- - "YY.MM.DD[, HH:mm:SS]"
-- - and so on.
--
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
df :: QuasiQuoter
instance GHC.Show.Show Data.Dates.Formats.FormatElement
instance GHC.Classes.Eq Data.Dates.Formats.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
parseDate :: DateTime -> String -> Either ParseError DateTime
-- | Parse date and time
parseDateTime :: 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 Data.Data.Data Data.Dates.DateIntervalType
instance GHC.Read.Read Data.Dates.DateIntervalType
instance GHC.Show.Show Data.Dates.DateIntervalType
instance GHC.Classes.Eq Data.Dates.DateIntervalType
instance Data.Data.Data Data.Dates.DateInterval
instance GHC.Show.Show Data.Dates.DateInterval
instance GHC.Classes.Eq Data.Dates.DateInterval
instance Data.Data.Data Data.Dates.WeekDay
instance GHC.Enum.Bounded Data.Dates.WeekDay
instance GHC.Enum.Enum Data.Dates.WeekDay
instance GHC.Classes.Ord Data.Dates.WeekDay
instance GHC.Read.Read Data.Dates.WeekDay
instance GHC.Show.Show Data.Dates.WeekDay
instance GHC.Classes.Eq Data.Dates.WeekDay