Skip to content

Month

A calendar month.

The twelve months are class fields, Month.JANUARY through Month.DECEMBER, and are also indexable by number: Month[1] through Month[12]. There is no constructor; the twelve values are the only instances.

Example

assert_eq $Month[1] $Month.JANUARY
assert (Month.JANUARY < Month.FEBRUARY)

Class Methods

(index) number -> Month

Returns the month with the given number.

Parameters

NameTypeDescription
number Int Month number, 1 through 12.

Errors

Exception Condition
ValueError The number is not 1 through 12

Example

assert_eq $Month[1] $Month.JANUARY

Methods

(eq) other

Compares two months.

(hash)()

Hashes the value.

(lt) other

Orders two months, in calendar order.

(str)()

Returns the uppercase English name, such as JANUARY.

next() -> Month

Returns the following month, wrapping from December to January.

previous() -> Month

Returns the preceding month, wrapping from January to December.