icalendar.timezone.provider module#

The interface for timezone implementations.

class icalendar.timezone.provider.TZProvider[source]#

Bases: ABC

Interface for timezone implementations.

abstractmethod create_timezone(name: str, transition_times, transition_info) tzinfo[source]#

Create a pytz timezone file given information.

abstractmethod fix_rrule_until(rrule: rrule, ical_rrule: prop.vRecur) None[source]#

Make sure the until value works for the rrule generated from the ical_rrule.

abstractmethod knows_timezone_id(id: str) bool[source]#

Whether the timezone is already cached by the implementation.

abstractmethod localize(dt: datetime, tz: tzinfo) datetime[source]#

Localize a datetime to a timezone.

abstractmethod localize_utc(dt: datetime) datetime[source]#

Return the datetime in UTC.

abstract property name: str#

The name of the implementation.

abstractmethod timezone(name: str) tzinfo | None[source]#

Return a timezone with a name or None if we cannot find it.

abstractmethod uses_pytz() bool[source]#

Whether we use pytz.

abstractmethod uses_zoneinfo() bool[source]#

Whether we use zoneinfo.