icalendar.tools module#

Utility functions for icalendar.

icalendar.tools.is_date(dt: date | datetime) bool[source]#

Whether this is a date and not a datetime.

icalendar.tools.is_datetime(dt: date | datetime) TypeIs[datetime][source]#

Whether this is a datetime and not just a date.

icalendar.tools.is_pytz(tz: tzinfo) bool[source]#

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

icalendar.tools.is_pytz_dt(dt: date | datetime) TypeIs[datetime][source]#

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

icalendar.tools.normalize_pytz(dt: date | datetime) date | datetime[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.

icalendar.tools.to_datetime(dt: date | datetime) datetime[source]#

Make sure we have a datetime, not a date.