-
Notifications
You must be signed in to change notification settings - Fork 436
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
Issue with event expansion #1478
Comments
|
Thanks for the detailed report @dozed |
One thing I forget to mention is that I wrote a small "hack" to fix another issue before: Subject: [PATCH] Trying to fix event expansion
---
Index: radicale/app/report.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/radicale/app/report.py b/radicale/app/report.py
--- a/radicale/app/report.py
+++ b/radicale/app/report.py
@@ -243,17 +243,27 @@
item = copy.copy(item)
vevent = item.vobject_item.vevent
- start_utc = vevent.dtstart.value.astimezone(datetime.timezone.utc)
- vevent.dtstart = ContentLine(
- name='DTSTART',
- value=start_utc.strftime('%Y%m%dT%H%M%SZ'), params={})
+ if isinstance(vevent.dtstart.value, datetime.datetime):
+ start_utc = vevent.dtstart.value.astimezone(datetime.timezone.utc)
+ vevent.dtstart = ContentLine(
+ name='DTSTART',
+ value=start_utc.strftime('%Y%m%dT%H%M%SZ'), params={})
+ else:
+ vevent.dtstart = ContentLine(
+ name='DTSTART',
+ value=vevent.dtstart.value.strftime('%Y%m%d'), params={})
dt_end = getattr(vevent, 'dtend', None)
if dt_end is not None:
- end_utc = dt_end.value.astimezone(datetime.timezone.utc)
- vevent.dtend = ContentLine(
- name='DTEND',
- value=end_utc.strftime('%Y%m%dT%H%M%SZ'), params={})
+ if isinstance(dt_end.value, datetime.datetime):
+ end_utc = dt_end.astimezone(datetime.timezone.utc)
+ vevent.dtend = ContentLine(
+ name='DTEND',
+ value=end_utc.strftime('%Y%m%dT%H%M%SZ'), params={})
+ else:
+ vevent.dtend = ContentLine(
+ name='DTEND',
+ value=dt_end.value.strftime('%Y%m%d'), params={})
timezones_to_remove = []
for component in item.vobject_item.components(): |
First off, in iCalendar 2.0, it's legal to use either a As @dozed points out, the problem occurs when dateutil 's r
That does however open the issue of a timezone -- without one, we'd still hit the same issue comparing naive So I think this really should be fixed in dateutil, which should have special handling for See https://github.com/dateutil/dateutil/blob/master/src/dateutil/rrule.py#L271-L302 Thoughts? |
Would it be possible to create a "dateutil" version/feature depending code sniplet until it is fixed there? If not fixed, one can't guess the version....can it be done by some kind of selftest during start....means as long as "dateutil" is not passing the selftest, use own implementation. |
which version of dateutil is currently used and can one try to use a newer one from here to check whether the issue is fixed meanwile: https://pypi.org/project/python-dateutil/#history |
_expand
expectsstart
andend
asdatetime
which leads to an issue withdateutil
'srruleset.between(start, end)
with the following iCalendar event:Radicale logs this error:
For a minimal test case see here: https://github.com/dozed/recur-issue-1/blob/main/test_recur_issue.py#L43-L55
The recurring-ical-events library seems to be able to handle mixed
date
/datetime
values (example).The text was updated successfully, but these errors were encountered: