Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
Quarter
data type.
Synopsis
- data Quarter
- data YearQuarter = YearQuarter {
- quarterYear :: !Integer
- quarterName :: !Quarter
- dayToYearQuarter :: Day -> YearQuarter
- firstDayOfYearQuarter :: YearQuarter -> Day
- lastDayOfYearQuarter :: YearQuarter -> Day
- yearQuarterInterval :: YearQuarter -> Interval Day
- yearQuarterToText :: YearQuarter -> Text
- parseYearQuarter :: Text -> Either String YearQuarter
Types
We explicitly enumerate quarter names. Using an Int
is unsafe.
Instances
Bounded Quarter Source # | |
Enum Quarter Source # | |
Eq Quarter Source # | |
Ord Quarter Source # | |
Read Quarter Source # | |
Show Quarter Source # | |
Generic Quarter Source # | |
Arbitrary Quarter Source # | |
Hashable Quarter Source # | |
Defined in Data.Time.Quarter | |
NFData Quarter Source # | |
Defined in Data.Time.Quarter | |
type Rep Quarter Source # | |
Defined in Data.Time.Quarter type Rep Quarter = D1 (MetaData "Quarter" "Data.Time.Quarter" "months-0.1-8UF2elrWYufCYn2Iw3nBtN" False) ((C1 (MetaCons "Q1" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Q2" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "Q3" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Q4" PrefixI False) (U1 :: Type -> Type))) |
data YearQuarter Source #
A quarter in Julian/Gregorian calendar.
YearQuarter | |
|
Instances
Conversion with Day
dayToYearQuarter :: Day -> YearQuarter Source #
firstDayOfYearQuarter :: YearQuarter -> Day Source #
First day of the quarter.
>>>
firstDayOfYearQuarter $ YearQuarter 2017 Q3
2017-07-01
lastDayOfYearQuarter :: YearQuarter -> Day Source #
Last day of the quarter
>>>
lastDayOfYearQuarter $ YearQuarter 2017 Q1
2017-03-31
>>>
lastDayOfYearQuarter $ YearQuarter 2016 Q2
2016-06-30
yearQuarterInterval :: YearQuarter -> Interval Day Source #
Day interval of month
>>>
yearQuarterInterval $ YearQuarter 2017 Q2
2017-04-01 ... 2017-06-30
Conversions with Text
yearQuarterToText :: YearQuarter -> Text Source #