Skip to content

Automatically created VTIMEZONE doesn't cover old datetime (e.g. in DTSTART/DTEND) #120

@schlatterbeck

Description

@schlatterbeck

Quick Summary
For an old appointment (from an old calendar) from before the year 2000 the generated VTIMEZONE does not match the datetime.

Context

Description
When I have times in a VEVENT before the year 2000 the automatically generated VTIMEZONE starts 2000.
This is especially important for times before 1980 since in most european countries there was no daylight saving time before 1980 (unless you go back to the 1940s). The Unix/Linux timezone info has the full picture, so vobject should export this correctly depending on the used datetime(s).

To Reproduce

import vobject
import datetime
from zoneinfo import ZoneInfo
 
cal = vobject.iCalendar ()
vev = cal.add ('vevent')
tz  = ZoneInfo ('Europe/Vienna')
vev.add ('dtstart').value = datetime.datetime (1970, 1, 1, tzinfo = tz)
vev.add ('dtend').value = datetime.datetime (1970, 8, 7, tzinfo = tz)
vev.add ('uid').value = 'Sample UID'
print (cal.serialize ())

yields the following, observe that the DTSTART of the VTIMEZONE is in the year 2000 while the VEVENT is in 1970. In 1970 Europe/Vienna doesn't have daylight savings.

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//PYVOBJECT//NONSGML Version 0.9.9//EN
BEGIN:VTIMEZONE
TZID:Europe/Vienna
BEGIN:STANDARD
DTSTART:20001029T040000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
TZNAME:CET
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:20000326T030000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
TZNAME:CEST
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
UID:Sample UID
DTSTART;TZID=Europe/Vienna:19700101T000000
DTEND;TZID=Europe/Vienna:19700807T000000
DTSTAMP:20250910T172032Z
END:VEVENT
END:VCALENDAR

I would be quite happy if there is a way to do this manually -- in fact very old appointments might not be the common use-case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions