Skip to content

[BUG] icalendar generates UTC timezone #1124

@niccokunzmann

Description

@niccokunzmann

Describe the bug

icalendar should not generate UTC timezone information.

To reproduce

    >>> from icalendar import Calendar, Event
    >>> from datetime import datetime
    >>> from zoneinfo import ZoneInfo
    >>> event = Event.new(
    ...     summary="Meeting in Zurich",
    ...     start=datetime(2022, 1, 1, 12, 0, 0, tzinfo=ZoneInfo("Europe/Zurich")),
    ...     end=datetime(2022, 1, 1, 13, 0, 0, tzinfo=ZoneInfo("Europe/Zurich")),
    ...     location="Zurich, Switzerland",
    ... )
    >>> calendar = Calendar.new(
    ...     subcomponents=[event],    
    ... )
    >>> calendar.add_missing_timezones()
    >>> calendar.timezones[0].tz_name
    "UTC"
    >>> calendar.timezones[1].tz_name
    'Europe/Zurich'

Expected behavior

UTC should not be generated.

Environment

  • Operating system: Xubuntu 24
  • Python version: 3.14
  • icalendar version: main@52b5142a160b94b411ad42183f2396daae2f0bc0 7.0.0a4.dev441

Additional context

  • I tested it with the latest version. For example, I used the command pip3 install --upgrade https://github.com/collective/icalendar.git.
  • I attached the .ics sample file, or there is no .ics sample file.

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