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, transition_times, transition_info)[source]#

Create a pytz timezone file given information.

Return type:

tzinfo

abstractmethod fix_rrule_until(rrule, ical_rrule)[source]#

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

Return type:

None

abstractmethod knows_timezone_id(id)[source]#

Whether the timezone is already cached by the implementation.

Return type:

bool

abstractmethod localize(dt, tz)[source]#

Localize a datetime to a timezone.

Return type:

datetime

abstractmethod localize_utc(dt)[source]#

Return the datetime in UTC.

Return type:

datetime

abstract property name: str#

The name of the implementation.

abstractmethod timezone(name)[source]#

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

Return type:

Optional[tzinfo]

abstractmethod uses_pytz()[source]#

Whether we use pytz.

Return type:

bool

abstractmethod uses_zoneinfo()[source]#

Whether we use zoneinfo.

Return type:

bool