diff --git a/radicale/xmlutils.py b/radicale/xmlutils.py index 8692783..f0f97cd 100644 --- a/radicale/xmlutils.py +++ b/radicale/xmlutils.py @@ -250,7 +250,7 @@ def _time_range_match(vobject_item, filter_, child_name): else: # Line 5 return start < dtstart + timedelta(days=1) and end > dtstart - elif child_name == "VTODO": + elif child_name == "VTODO": # TODO: implement this dtstart = getattr(child, "dtstart", None) duration = getattr(child, "duration", None) @@ -307,8 +307,30 @@ def _time_range_match(vobject_item, filter_, child_name): return True elif child_name == "VJOURNAL": - # TODO: implement this - pass + dtstart = getattr(child, "dstart", None) + + if dtstart is not None: + dtstart = dtstart.value + if not isinstance(dtstart, datetime): + dtstart_is_datetime = False + # TODO: changing dates to datetimes may be wrong because of tz + dtstart = datetime.combine(dtstart, datetime.min.time()).replace( + tzinfo=timezone.utc) + else: + dtstart_is_datetime = True + + + if dtstart_is_datetime: + # Line 1 + return start <= dtstart and end > dtstart + else: + # Line 2 + return start < dtstart + timedelta(days=1) and end > dtstart + + else: + # Line 3 + return False + return True