icalendar.prop.recur.month module#

BYMONTH value type of RECUR from RFC 5545 and RFC 7529.

class icalendar.prop.recur.month.vMonth(month: str | int, /, params: dict[str, Any] | None = None)[source]#

Bases: int

The number of the month for recurrence.

In RFC 5545, this is just an int. In RFC 7529, this can be followed by L to indicate a leap month.

>>> from icalendar import vMonth
>>> vMonth(1) # first month January
vMonth('1')
>>> vMonth("5L") # leap month in Hebrew calendar
vMonth('5L')
>>> vMonth(1).leap
False
>>> vMonth("5L").leap
True

Definition from RFC:

type-bymonth = element bymonth {
   xsd:positiveInteger |
   xsd:string
}
classmethod from_ical(ical)[source]#
property ical_value: int#

Return the Python int value.

This property provides access to the underlying month number as an integer. The leap month indicator is not included in the integer value; use the leap property to check if this is a leap month.

Returns:

The month number (1-12 for standard months).

Return type:

int

Example

>>> from icalendar.prop import vMonth
>>> m = vMonth(5)
>>> m.ical_value
5
>>> m_leap = vMonth("5L")
>>> m_leap.ical_value
5
>>> m_leap.leap
True

See also

RFC 5545 Section 3.3.10 for the BYMONTH value type specification. RFC 7529 for leap month support.

property leap: bool#

Whether this is a leap month.

params: Parameters#
classmethod parse_jcal_value(value)[source]#

Parse a jCal value for vMonth.

Raises:

JCalParsingError – If the value is not a valid month.

Return type:

None

to_ical()[source]#

The ical representation.

Return type:

bytes