Month

The built-in type Month represents months.

It has the following definition:

type Month
  | January | February | March
  | April | May | June
  | July | August | September
  | October | November | December

toInt : Month -> Int

Returns the month value for the given month.

Examples

val jan = Month::toInt January
//      = 1

val aug = Month::toInt August
//      = 8

fromInt : Int -> Month

Constructs a Month from a month value.

This function is partial and fails if the month value is outside the range [1 .. 12].

Examples

val jan = Month::fromInt 1
//      = January

val aug = Month::fromInt 9
//      = August

firstDayOfMonth : Boolean -> Month -> Int

Returns the day-of-year of the 1st of the given month. The boolean argument flags whether the year is a leap year or not.

Examples

val firstOfAugustLeapYear = Month::firstDayOfMonth True August
//                        = 214

val firstOfAugustNonLeapYear = Month::firstDayOfMonth False August
//                           = 213

firstMonthOfQuarter : Month -> Month

Returns the first month of the quarter containing the given month.

Examples

val jan = Month::firstMonthOfQuarter March
//      = January

val apr = Month::firstMonthOfQuarter May
//      = April