Skip to content

jCal TIME parsing drops TZID and turns zoned times into floating times #2154

Description

@shrohan2003

Describe the bug

A jCal TIME property with a TZID loses its timezone when parsed. Serializing the component then produces a floating time, changing the meaning of the value.

To reproduce

from icalendar import Event

jcal = [
    "vevent",
    [["x-time", {"tzid": "Asia/Dhaka"}, "time", "08:30:00"]],
    [],
]
event = Event.from_jcal(jcal)
print(event["X-TIME"].dt.tzinfo)
print(event.to_jcal())

Output on current main:

None
['vevent', [['x-time', {}, 'time', '08:30:00']], []]

Expected behavior

The parsed time retains Asia/Dhaka, and the TZID survives the jCal round trip. The same TIME property parsed through xCal retains the timezone. vTime.from_jcal() parses the clock value without applying the supplied TZID before constructing the property, whose constructor updates the parameters from the resulting naive time.

Environment

  • Operating system: Linux
  • Python version: 3.13.18
  • icalendar version: main at 60cdd8a

Additional context

  • I tested it with the latest version.
  • There is no .ics sample file. The complete jCal reproduction is above.

Reproduced with Codex (GPT-6) assistance while investigating calendar serialization bugs. This uses a built-in IANA timezone and is independent of custom VTIMEZONE registration in #2050.

Activity

  1. github-actions commented on Nov 19, 2026

    @github-actions
    Contributor

    Thanks for the issue, @shrohan2003! A maintainer will review it shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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