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
Class Fields
APRIL @ Month[get, set]April.
AUGUST @ Month[get, set]August.
DECEMBER @ Month[get, set]December.
FEBRUARY @ Month[get, set]February.
JANUARY @ Month[get, set]January.
JULY @ Month[get, set]July.
JUNE @ Month[get, set]June.
MARCH @ Month[get, set]March.
MAY @ Month[get, set]May.
NOVEMBER @ Month[get, set]November.
OCTOBER @ Month[get, set]October.
SEPTEMBER @ Month[get, set]September.
Class Methods
(index) number -> Month
Returns the month with the given number.
Parameters
| Name | Type | Description |
|---|---|---|
number |
Int |
Month number, 1 through 12. |
Errors
| Exception | Condition |
|---|---|
ValueError |
The number is not 1 through 12 |
Example
Methods
(eq) other -> Bool
Compares two months.
Parameters
| Name | Type | Description |
|---|---|---|
other |
Value |
(lt) other -> Bool
Orders two months, in calendar order.
Parameters
| Name | Type | Description |
|---|---|---|
other |
Month |
(str)() -> 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.