diff options
author | Ken Murchison <murch@andrew.cmu.edu> | 2017-02-23 10:47:48 -0500 |
---|---|---|
committer | Ken Murchison <murch@andrew.cmu.edu> | 2017-02-23 10:47:48 -0500 |
commit | 758155e94bc3375f28bcf4c0342e83acc76286c9 (patch) | |
tree | d5d95ffe34088657a1acfdb570944b859dde5877 | |
parent | db49373f1bf3086338e6bca43cb2e86614c4144d (diff) | |
download | libical-git-758155e94bc3375f28bcf4c0342e83acc76286c9.tar.gz |
icalcomponent.c: properly handle recurring tasks with only due time, and all-day events wuth no dtend/duration
-rw-r--r-- | src/libical/icalcomponent.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libical/icalcomponent.c b/src/libical/icalcomponent.c index 498d8be1..6439f6f4 100644 --- a/src/libical/icalcomponent.c +++ b/src/libical/icalcomponent.c @@ -884,12 +884,24 @@ void icalcomponent_foreach_recurrence(icalcomponent *comp, dtstart = icalcomponent_get_dtstart(comp); + if (icaltime_is_null_time(dtstart) && + icalcomponent_isa(comp) == ICAL_VTODO_COMPONENT) { + /* VTODO with no DTSTART - use DUE */ + dtstart = icalcomponent_get_due(comp); + } if (icaltime_is_null_time(dtstart)) return; /* The end time could be specified as either a DTEND or a DURATION */ /* icalcomponent_get_dtend takes care of these cases. */ dtend = icalcomponent_get_dtend(comp); + if (icaltime_is_null_time(dtend) && icaltime_is_date(dtstart)) { + /* No DTEND or DURATION and DTSTART is DATE - duration is 1 day */ + struct icaldurationtype dur = icaldurationtype_null_duration(); + + dur.days = 1; + dtend = icaltime_add(dtstart, dur); + } /* Now set up the base span for this item, corresponding to the base DTSTART and DTEND */ |