-
-
Notifications
You must be signed in to change notification settings - Fork 0
fix: remove unneccerasy conversion of recurrence IDs to UTC #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: remove unneccerasy conversion of recurrence IDs to UTC #124
Conversation
- Add failing test to ensure calendar merger accepts both date and datetime recurrence IDs in iCal events - Test demonstrates current issue where date-only recurrence IDs break calendar merging - Will be followed by fix to properly handle both types of recurrence IDs Part of bug #123
TODO: fix the issue so the test don't fail :) |
def test_merge_calendars_with_date_recurrence_id(merge: Any) -> None: | ||
"""Test that merging calendars works with both date and datetime recurrence IDs.""" | ||
merged = merge(["calendar_with_date_recurrence_id.ics"]) | ||
events = list(merged.walk("VEVENT")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with the latest icalendar, you can do merged.events
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know
for event in recurrence_events: | ||
recurrence_id = event["RECURRENCE-ID"].dt | ||
# Should be either a date or datetime | ||
assert isinstance(recurrence_id, (date, datetime)), ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, here one could test if a certain recurrence id is included. The fix could also just delete the event or skip it - would the test then still succeed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason we want to convert the recurrence ID to UTC?
If yes, then we should test if the recurrence ID is a datetime object, and only then converted to UTC. Otherwise, leave it as a date.
That's how I think we should fix the issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason we want to convert the recurrence ID to UTC?
I did that for recurring ical events because I wanted to match them (some are without timezone, some with, some use date although they should use datetime). It might not be needed at all for this use case - I would say it is probably worth not converting to UTC and waiting for an issue to arise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rare case is: microsoft outlook (date recurrence id) gets accepted by another client, this converts the id and then sends it back and now they do not match. But that is not of concern here, I think.
(merging calendars <= accepting invites)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I agree
I don't think this is a concern we need to focus on yet
That bring us to the solution of just removing the conversion to UTC, correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think yes!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
less code better code :)
Codecov ReportAll modified and coverable lines are covered by tests ✅
🚀 New features to boost your workflow:
|
c29df98
to
bde3ff3
Compare
…lendar-with-date-only-recurrence-id
Part of bug #123
Closes #126
Description of change
Pull-Request Checklist
main
branchFixes #0000