Skip to content

Collision on TZID with short timezone names #117

@schlatterbeck

Description

@schlatterbeck

Quick Summary
Three letter timezone names are not internationally standardized. Using them as TZID will produce collisions.

Context

  • vObject version 0.9.9 PRODID:-//PYVOBJECT//NONSGML Version 0.9.9//EN (installed via pip, Debian ships an older version)
  • Python version 3.13
  • Operating system and version: Debian 13.1 aka Trixie

Description
Take for example the time zone of Tel Aviv called 'Israel Standard Time' abbreviated IST and the time zone of Calcutta, 'Indian Standard Time' also abbreviated IST. Both timezones are, of course, different. When vobject encounters both, it will still use 'IST' as the TZID but use only one of the time zones whatever is encountered first. So using the short timezone name as TZID is a bug.

To Reproduce

import vobject
import datetime
from zoneinfo import ZoneInfo
 
cal = vobject.iCalendar ()
vev = cal.add ('vevent')
tz1 = ZoneInfo ('Asia/Kolkata')
tz2 = ZoneInfo ('Asia/Tel_Aviv')
vev.add ('dtstart').value = datetime.datetime (2025, 8, 7, tzinfo = tz1)
vev.add ('dtend').value = datetime.datetime (2025, 8, 7, tzinfo = tz2)
vev.add ('uid').value = 'Sample UID'
print (cal.serialize ())

results in

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//PYVOBJECT//NONSGML Version 0.9.9//EN
BEGIN:VTIMEZONE
TZID:IST
BEGIN:STANDARD
DTSTART:20000101T000000
RRULE:FREQ=YEARLY;BYMONTH=1
TZNAME:IST
TZOFFSETFROM:+0530
TZOFFSETTO:+0530
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
UID:Sample UID
DTSTART;TZID=IST:20250807T000000
DTEND;TZID=IST:20250807T000000
DTSTAMP:20250908T174548Z
END:VEVENT
END:VCALENDAR

The Israel 'IST' timezone is missing in this example.
When exchanging tz1 and tz2 it's the other way round (the indian tz is much simpler so I chose this as tz1 to make the example shorter)

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