Repository navigation
Conversation
…lendar#2154) When parsing a jCal TIME property with a `tzid` parameter via `vTime.from_jcal`, the parameter dictionary was passed into `cls(value, params=...)` with an unlocalized naive `datetime.time`. `vTime.__init__` invoked `update_tzid_from(self.dt)`, which cleared the `tzid` from the parameters because `self.dt` lacked a timezone, causing the parsed property to lose its timezone and serialize to floating time. Localize `value` with `tzp.localize(value, params.tzid)` in `vTime.from_jcal` prior to instantiation, matching `vDatetime.from_jcal` and ensuring both `dt.tzinfo` and `params['TZID']` are preserved across jCal round trips. Resolves PyCalendar#2154 Signed-off-by: Raj Gahoi <gahoiraj01@gmail.com>
RajGahoi
requested review from
angatha,
niccokunzmann and
stevepiercy
as code owners
November 20, 2026 04:25
Contributor
|
Thanks for the pull request, @RajGahoi! A maintainer will review it shortly. |
Contributor
Mixed activityActivity patterns show a mix of organic and automated signals. Evidence
Last 5 PRs: This is an automated analysis by AgentScan |
Contributor
|
One or more PR-quality checks did not pass. Review the PR Quality Checks summary in the workflow run for the failed checks and their details, then make any necessary updates. Checklist items may remain unchecked while work is in progress. Please tick each item as you complete it. If you used AI assistance, follow the project's Responsible AI use policy and provide the required disclosures. |
Contributor
|
Thanks for the contribution. However, there's already an open PR (#2155) for this issue. Would you please review that PR and provide some feedback to the author? |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked issue
Description
When parsing a jCal
timeproperty that specifies atzidparameter (e.g.["x-time", {"tzid": "Asia/Dhaka"}, "time", "08:30:00"]),vTime.from_jcalconstructedcls(value, params=...)wherevaluewas an unlocalized naivedatetime.time.During
vTime.__init__,self.params.update_tzid_from(self.dt)was called. Becauseself.dt.tzinfowasNone,tzid_from_dt(self.dt)evaluated toNone, thereby deleting thetzidfrom the property parameters. As a result, zoned times were converted into floating times on serialization, breaking round-trip fidelity.This PR fixes the issue by:
params = Parameters.from_jcal_property(jcal_property)before parsing value.valueusingtzp.localize(value, params.tzid)whenparams.tzidis present, matching the behavior ofvDatetime.from_jcal.test_section_3_6_values.pyverifying that parsedvTimeinstances retaindt.tzinfo, preserveparams["TZID"], and round-trip cleanly viato_jcal().news/2154.bugfix.Checklist
Additional information
Verified locally against
test_time.py,test_timezoned.py, and the fullrfc_7265_jcaltest suite (140 unit tests passing).