icalendar.prop.recur.weekday module#

BYDAY and WKST value type of RECUR from RFC 5545.

class icalendar.prop.recur.weekday.vWeekday(value, encoding='utf-8', /, params=None)[source]#

Bases: str

Either a weekday or a weekdaynum.

>>> from icalendar import vWeekday
>>> vWeekday("MO") # Simple weekday
'MO'
>>> vWeekday("2FR").relative # Second friday
2
>>> vWeekday("2FR").weekday
'FR'
>>> vWeekday("-1SU").relative # Last Sunday
-1

Definition from RFC 5545 Section 3.3.10:

weekdaynum = [[plus / minus] ordwk] weekday
plus        = "+"
minus       = "-"
ordwk       = 1*2DIGIT       ;1 to 53
weekday     = "SU" / "MO" / "TU" / "WE" / "TH" / "FR" / "SA"
;Corresponding to SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY,
;FRIDAY, and SATURDAY days of the week.
classmethod from_ical(ical)[source]#
classmethod from_xcal(xml)[source]#

Parse xCal from RFC 6321.

Parameters:

xml (XCalParser | ElementAdapter | Element) – The XML to parse or a parser.

Raises:

XCalParsingError – If the provided xCal is invalid.

Return type:

VProp

property ical_value: str#

Returns the weekday value as a string, for example, MO, +2TH, or -1SU.

See also

RFC 5545 Section 3.3.10 for the BYDAY rule grammar.

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

Parse a jCal value for vWeekday.

Raises:

JCalParsingError – If the value is not a valid weekday.

Return type:

Self

relative#
to_ical()[source]#
Return type:

bytes

to_xcal(element)[source]#

Add the xCal representation of this property according to RFC 6321.

Return type:

None

week_days = {'FR': 5, 'MO': 1, 'SA': 6, 'SU': 0, 'TH': 4, 'TU': 2, 'WE': 3}#
weekday#