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 Source #

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

Ord Month Source # 
Instance details

Defined in Data.Time.Month

Read Month Source # 
Instance details

Defined in Data.Time.Month

Show Month Source # 
Instance details

Defined in Data.Time.Month

Generic Month Source # 
Instance details

Defined in Data.Time.Month

Associated Types

type Rep Month :: Type -> Type Source #

Methods

from :: Month -> Rep Month x Source #

to :: Rep Month x -> Month Source #

NFData Month Source # 
Instance details

Defined in Data.Time.Month

Methods

rnf :: Month -> () Source #

Hashable Month Source # 
Instance details

Defined in Data.Time.Month

Methods

hashWithSalt :: Int -> Month -> Int

hash :: Month -> Int

Arbitrary Month Source # 
Instance details

Defined in Data.Time.Month

Methods

arbitrary :: Gen Month

shrink :: Month -> [Month]

type Rep Month Source # 
Instance details

Defined in Data.Time.Month

type Rep Month = D1 (MetaData "Month" "Data.Time.Month" "months-0.1-inplace" 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 Source #

NFData YearMonth Source # 
Instance details

Defined in Data.Time.Month

Methods

rnf :: YearMonth -> () Source #

Hashable YearMonth Source # 
Instance details

Defined in Data.Time.Month

Arbitrary YearMonth Source # 
Instance details

Defined in Data.Time.Month

FromJSON YearMonth Source # 
Instance details

Defined in Data.Time.Month

Methods

parseJSON :: Value -> Parser YearMonth

parseJSONList :: Value -> Parser [YearMonth]

FromJSONKey YearMonth Source # 
Instance details

Defined in Data.Time.Month

Methods

fromJSONKey :: FromJSONKeyFunction YearMonth

fromJSONKeyList :: FromJSONKeyFunction [YearMonth]

ToJSON YearMonth Source #

TODO: use builder if we really want speed

Instance details

Defined in Data.Time.Month

Methods

toJSON :: YearMonth -> Value

toEncoding :: YearMonth -> Encoding

toJSONList :: [YearMonth] -> Value

toEncodingList :: [YearMonth] -> Encoding

ToJSONKey YearMonth Source # 
Instance details

Defined in Data.Time.Month

Methods

toJSONKey :: ToJSONKeyFunction YearMonth

toJSONKeyList :: ToJSONKeyFunction [YearMonth]

FromField YearMonth Source # 
Instance details

Defined in Data.Time.Month

Methods

parseField :: Field -> Parser YearMonth

ToField YearMonth Source # 
Instance details

Defined in Data.Time.Month

Methods

toField :: YearMonth -> Field

FromHttpApiData YearMonth Source # 
Instance details

Defined in Data.Time.Month

ToHttpApiData 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 ()

ToParamSchema YearMonth Source #

Format "month" corresponds to yyyy-mm format.

Instance details

Defined in Data.Time.Month

Methods

toParamSchema :: Proxy YearMonth -> ParamSchema t

ToSchema YearMonth Source # 
Instance details

Defined in Data.Time.Month

Methods

declareNamedSchema :: Proxy YearMonth -> Declare (Definitions Schema) NamedSchema

type Rep YearMonth Source # 
Instance details

Defined in Data.Time.Month

type Rep YearMonth = D1 (MetaData "YearMonth" "Data.Time.Month" "months-0.1-inplace" 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