adding VJournal method

This commit is contained in:
Nicolas Bonfante 2016-06-15 09:55:30 +02:00
parent 40406359e5
commit e1f3045f1f

View File

@ -254,8 +254,30 @@ def _time_range_match(vobject_item, filter_, child_name):
# TODO: implement this # TODO: implement this
pass pass
elif child_name == "VJOURNAL": elif child_name == "VJOURNAL":
# TODO: implement this dtstart = getattr(child, "dstart", None)
pass
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 return True