icalendar.timezone.tzp module#
- class icalendar.timezone.tzp.TZP(provider: str | TZProvider = 'zoneinfo')[source]#
Bases:
object
This is the timezone provider proxy.
If you would like to have another timezone implementation, you can create a new one and pass it to this proxy. All of icalendar will then use this timezone implementation.
- cache_timezone_component(timezone_component: Timezone.Timezone) None [source]#
Cache the timezone that is created from a timezone component if it is not already known.
This can influence the result from timezone(): Once cached, the custom timezone is returned from timezone().
- clean_timezone_id(tzid: str) str [source]#
Return a clean version of the timezone id.
Timezone ids can be a bit unclean, starting with a / for example. Internally, we should use this to identify timezones.
- create_timezone(timezone_component: Timezone.Timezone) datetime.tzinfo [source]#
Create a timezone from a timezone component.
This component will not be cached.
- fix_rrule_until(rrule: rrule, ical_rrule: prop.vRecur) None [source]#
Make sure the until value works.
- localize(dt: datetime.date, tz: datetime.tzinfo | str | None) datetime.datetime [source]#
Localize a datetime to a timezone.
- localize_utc(dt: datetime.date) datetime.datetime [source]#
Return the datetime in UTC.
If the datetime has no timezone, set UTC as its timezone.
- timezone(tz_id: str) datetime.tzinfo | None [source]#
Return a timezone with an id or None if we cannot find it.
- use(provider: str | TZProvider)[source]#
Switch to a different timezone provider.