icalendar.prop.dt.date module#
DATE property type from RFC 5545.
- class icalendar.prop.dt.date.vDate(dt, params=None)[source]#
Bases:
TimeBaseDate
- Value Name:
DATE
- Purpose:
This value type is used to identify values that contain a calendar date.
- Format Definition:
This value type is defined by the following notation:
date = date-value date-value = date-fullyear date-month date-mday date-fullyear = 4DIGIT date-month = 2DIGIT ;01-12 date-mday = 2DIGIT ;01-28, 01-29, 01-30, 01-31 ;based on month/year- Description:
If the property permits, multiple "date" values are specified as a COMMA-separated list of values. The format for the value type is based on the [ISO.8601.2004] complete representation, basic format for a calendar date. The textual format specifies a four-digit year, two-digit month, and two-digit day of the month. There are no separator characters between the year, month, and day component text.
Example
The following represents July 14, 1997:
19970714>>> from icalendar.prop import vDate >>> date = vDate.from_ical('19970714') >>> date.year 1997 >>> date.month 7 >>> date.day 14
- static from_ical(ical)[source]#
Parse an iCalendar DATE value.
- Parameters:
ical (
str) – Required. The DATE value inYYYYMMDDformat.- Raises:
ICalParsingError – If the value is not a valid DATE.
- Return type:
- 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:
- 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_element(element)[source]#
Parse an xCal date element according to RFC 6321.
- Parameters:
element (
ElementAdapter) – Required. The xCal element to parse.- Return type:
- Returns:
The date object.
- Raises:
XCalParsingError – If the provided xCal is invalid.
- property ical_value: date#
Returns the date as a date value, in year-month-day format.
See also
RFC 5545 Section 3.3.4 for the
DATEvalue type.
- params: Parameters#
- classmethod parse_jcal_value(jcal)[source]#
Parse a jCal string to a
datetime.date.- Raises:
JCalParsingError – If it can't parse a date.
- Return type: