Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
Month
data type.
Synopsis
- data MonthName
- dayToYearMonthName :: Day -> (Year, MonthName)
- firstDayOfYearMonthName :: (Year, MonthName) -> Day
- lastDayOfYearMonthName :: (Year, MonthName) -> Day
- yearMonthNameInterval :: (Year, MonthName) -> Interval Day
- monthNameToText :: MonthName -> Text
- parseMonthName :: Text -> Either String MonthName
- yearMonthNameToText :: (Year, MonthName) -> Text
- parseYearMonthName :: Text -> Either String (Year, MonthName)
Types
We explicitly enumerate month names. Using an Int
is unsafe.
Instances
Conversion with Day
dayToYearMonthName :: Day -> (Year, MonthName) Source #
Extract Month
from Day
>>>
dayToYearMonthName (read "2017-02-03")
(2017,February)
firstDayOfYearMonthName :: (Year, MonthName) -> Day Source #
First day of the month.
>>>
firstDayOfYearMonthName (2017, February)
2017-02-01
lastDayOfYearMonthName :: (Year, MonthName) -> Day Source #
Last day of the month
>>>
lastDayOfYearMonthName (2017, February)
2017-02-28
>>>
lastDayOfYearMonthName (2016, February)
2016-02-29
yearMonthNameInterval :: (Year, MonthName) -> Interval Day Source #
Day interval of month
>>>
yearMonthNameInterval (2017, February)
2017-02-01 ... 2017-02-28
Conversions with Text
monthNameToText :: MonthName -> Text Source #