icalendar.tools module#

Utility functions for icalendar.

icalendar.tools.is_date(dt)[source]#

Whether this is a date and not a datetime.

Return type:

bool

icalendar.tools.is_datetime(dt)[source]#

Whether this is a datetime and not just a date.

Return type:

TypeIs[datetime]

icalendar.tools.is_pytz(tz)[source]#

Whether the timezone requires localize() and normalize().

Return type:

bool

icalendar.tools.is_pytz_dt(dt)[source]#

Whether the time requires localize() and normalize().

Return type:

TypeIs[datetime]

icalendar.tools.normalize_pytz(dt)[source]#

We have to normalize the time after a calculation if we use pytz.

pytz requires this function to be used in order to correctly calculate the timezone’s offset after calculations.

Return type:

Union[date, datetime]

icalendar.tools.to_datetime(dt)[source]#

Make sure we have a datetime, not a date.

Return type:

datetime