months-0.1: Month, YearMonth, Quarter, YearQuarter types

Safe HaskellTrustworthy
LanguageHaskell2010

Data.Time.Month

Contents

Description

Month data type.

Synopsis

Types

data Month Source #

We explicitly enumerate month names. Using an Int is unsafe.

Instances
Bounded Month Source # 
Instance details

Defined in Data.Time.Month

Enum Month Source # 
Instance details

Defined in Data.Time.Month

Eq Month Source # 
Instance details

Defined in Data.Time.Month

Methods

(==) :: Month -> Month -> Bool #

(/=) :: Month -> Month -> Bool #

Ord Month Source # 
Instance details

Defined in Data.Time.Month

Methods

compare :: Month -> Month -> Ordering #

(<) :: Month -> Month -> Bool #

(<=) :: Month -> Month -> Bool #

(>) :: Month -> Month -> Bool #

(>=) :: Month -> Month -> Bool #

max :: Month -> Month -> Month #

min :: Month -> Month -> Month #

Read Month Source # 
Instance details

Defined in Data.Time.Month

Show Month Source # 
Instance details

Defined in Data.Time.Month

Methods

showsPrec :: Int -> Month -> ShowS #

show :: Month -> String #

showList :: [Month] -> ShowS #

Generic Month Source # 
Instance details

Defined in Data.Time.Month

Associated Types

type Rep Month :: Type -> Type #

Methods

from :: Month -> Rep Month x #

to :: Rep Month x -> Month #

Arbitrary Month Source # 
Instance details

Defined in Data.Time.Month

Methods

arbitrary :: Gen Month #

shrink :: Month -> [Month] #

Hashable Month Source # 
Instance details

Defined in Data.Time.Month

Methods

hashWithSalt :: Int -> Month -> Int #

hash :: Month -> Int #

NFData Month Source # 
Instance details

Defined in Data.Time.Month

Methods

rnf :: Month -> () #

type Rep Month Source # 
Instance details

Defined in Data.Time.Month

type Rep Month = D1 (MetaData "Month" "Data.Time.Month" "months-0.1-8UF2elrWYufCYn2Iw3nBtN" False) (((C1 (MetaCons "January" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "February" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "March" PrefixI False) (U1 :: Type -> Type))) :+: (C1 (MetaCons "April" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "May" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "June" PrefixI False) (U1 :: Type -> Type)))) :+: ((C1 (MetaCons "July" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "August" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "September" PrefixI False) (U1 :: Type -> Type))) :+: (C1 (MetaCons "October" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "November" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "December" PrefixI False) (U1 :: Type -> Type)))))

data YearMonth Source #

A month in Julian/Gregorian calendar.

Constructors

YearMonth 

Fields

Instances
Enum YearMonth Source # 
Instance details

Defined in Data.Time.Month

Eq YearMonth Source # 
Instance details

Defined in Data.Time.Month

Ord YearMonth Source # 
Instance details

Defined in Data.Time.Month

Show YearMonth Source #

Doesn't print field names.

Instance details

Defined in Data.Time.Month

Generic YearMonth Source # 
Instance details

Defined in Data.Time.Month

Associated Types

type Rep YearMonth :: Type -> Type #

Arbitrary YearMonth Source # 
Instance details

Defined in Data.Time.Month

Hashable YearMonth Source # 
Instance details

Defined in Data.Time.Month

ToJSON YearMonth Source #

TODO: use builder if we really want speed

Instance details

Defined in Data.Time.Month

ToJSONKey YearMonth Source # 
Instance details

Defined in Data.Time.Month

FromJSON YearMonth Source # 
Instance details

Defined in Data.Time.Month

FromJSONKey YearMonth Source # 
Instance details

Defined in Data.Time.Month

FromField YearMonth Source # 
Instance details

Defined in Data.Time.Month

ToField YearMonth Source # 
Instance details

Defined in Data.Time.Month

Methods

toField :: YearMonth -> Field #

NFData YearMonth Source # 
Instance details

Defined in Data.Time.Month

Methods

rnf :: YearMonth -> () #

ToHttpApiData YearMonth Source # 
Instance details

Defined in Data.Time.Month

FromHttpApiData YearMonth Source # 
Instance details

Defined in Data.Time.Month

ToHtml YearMonth Source # 
Instance details

Defined in Data.Time.Month

Methods

toHtml :: Monad m => YearMonth -> HtmlT m () #

toHtmlRaw :: Monad m => YearMonth -> HtmlT m () #

ToSchema YearMonth Source # 
Instance details

Defined in Data.Time.Month

ToParamSchema YearMonth Source #

Format "month" corresponds to yyyy-mm format.

Instance details

Defined in Data.Time.Month

type Rep YearMonth Source # 
Instance details

Defined in Data.Time.Month

type Rep YearMonth = D1 (MetaData "YearMonth" "Data.Time.Month" "months-0.1-8UF2elrWYufCYn2Iw3nBtN" False) (C1 (MetaCons "YearMonth" PrefixI True) (S1 (MetaSel (Just "monthYear") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Integer) :*: S1 (MetaSel (Just "monthName") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Month)))

Conversion with Day

dayToYearMonth :: Day -> YearMonth Source #

Extract Month from Day

>>> dayToYearMonth (read "2017-02-03")
YearMonth 2017 February

firstDayOfYearMonth :: YearMonth -> Day Source #

First day of the month.

>>> firstDayOfYearMonth $ YearMonth 2017 February
2017-02-01

lastDayOfYearMonth :: YearMonth -> Day Source #

Last day of the month

>>> lastDayOfYearMonth $ YearMonth 2017 February
2017-02-28
>>> lastDayOfYearMonth $ YearMonth 2016 February
2016-02-29

yearMonthInterval :: YearMonth -> Interval Day Source #

Day interval of month

>>> yearMonthInterval $ YearMonth 2017 February
2017-02-01 ... 2017-02-28

Conversions with Text