mirror of
https://github.com/Kozea/Radicale.git
synced 2025-06-26 16:45:52 +00:00
solving bug when trying to filter an Event on a DATETIME which have no timezone
This commit is contained in:
parent
1cf8ec0599
commit
dfc215b63f
1 changed files with 6 additions and 0 deletions
|
@ -220,6 +220,9 @@ def _time_range_match(vobject_item, filter_, child_name):
|
|||
if child_name == "VEVENT":
|
||||
# TODO: check if there's a timezone
|
||||
dtstart = child.dtstart.value
|
||||
if isinstance(dtstart, datetime) and not dtstart.tzinfo:
|
||||
dtstart = dtstart.replace(tzinfo=timezone.utc)
|
||||
|
||||
if not isinstance(dtstart, datetime):
|
||||
dtstart_is_datetime = False
|
||||
# TODO: changing dates to datetimes may be wrong because of tz
|
||||
|
@ -235,6 +238,9 @@ def _time_range_match(vobject_item, filter_, child_name):
|
|||
if not isinstance(dtend, datetime):
|
||||
dtend = datetime.combine(dtend, datetime.min.time()).replace(
|
||||
tzinfo=timezone.utc)
|
||||
if isinstance(dtend, datetime) and not dtend.tzinfo:
|
||||
dtend = dtend.replace(tzinfo=timezone.utc)
|
||||
|
||||
return start < dtend and end > dtstart
|
||||
elif duration is not None:
|
||||
duration = duration.value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue