icalendar.prop.dt.types module#

Combined property type for the date and time properties from RFC 5545.

class icalendar.prop.dt.types.vDDDTypes(dt, params=None)[source]#

Bases: TimeBase

A combined Datetime, Date or Duration parser/generator. Their format cannot be confused, and often values can be of either types. So this is practical.

VALUE_MAP: dict[str, vDate | vTime | vDatetime | vDuration | vPeriod] = {'DATE': <class 'icalendar.prop.dt.date.vDate'>, 'DATE-TIME': <class 'icalendar.prop.dt.datetime.vDatetime'>, 'DURATION': <class 'icalendar.prop.dt.duration.vDuration'>, 'PERIOD': <class 'icalendar.prop.dt.period.vPeriod'>, 'TIME': <class 'icalendar.prop.dt.time.vTime'>}#

Map the VALUE parameters of the different types to their class.

default_value: ClassVar[str] = 'DATE-TIME'#
dt: datetime | date | timedelta | time | tuple[datetime, datetime] | tuple[datetime, timedelta]#
property dts: list#

Compatibility method to return a list of datetimes.

classmethod examples()[source]#

Examples of vDDDTypes.

Return type:

list[vDDDTypes]

classmethod from_ical(ical, timezone=None)[source]#
classmethod from_jcal(jcal_property)[source]#

Parse jCal from RFC 7265.

Parameters:

jcal_property (list) – The jCal property to parse.

Raises:

JCalParsingError – If the provided jCal is invalid.

Return type:

Self

classmethod from_xcal(xml)[source]#

Parse xCal according to RFC 6321.

Parameters:
  • parser – Required. The xCal to parse or a parser.

  • params – Required. The parameters of the xCal element.

Raises:

XCalParsingError – If the provided xCal is invalid.

Return type:

VProp

classmethod from_xcal_in_recur(xml)[source]#

Parse xCal according to RFC 6321.

Parameters:
  • parser – Required. The xCal to parse or a parser.

  • params – Required. The parameters of the xCal element.

Raises:

XCalParsingError – If the provided xCal is invalid.

Return type:

VProp

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

Parse a jCal value.

Raises:

JCalParsingError – If the value can't be parsed as either a date, time, date-time, duration, or period.

Return type:

datetime | date | timedelta | time | tuple[datetime, datetime] | tuple[datetime, timedelta]

property td: timedelta#

Compatibility property returning self.dt.

This class is used to replace different time components. Some of them contain a datetime or date (.dt). Some of them contain a timedelta (.td). This property allows interoperability.

to_ical()[source]#

Return the ical representation.

Return type:

bytes

to_jcal(name)[source]#

The jCal representation of this property according to RFC 7265.

Return type:

list

to_property_type()[source]#

Convert to a property type.

Raises:

ValueError – If the type is unknown.

Return type:

vDatetime | vDate | vDuration | vTime | vPeriod

to_xcal(element)[source]#

Convert a vDDDTypes to an xCal element.

Return type:

None