plugins/libcalendaring

Thomas Brüderli bruederli at kolabsys.com
Tue Mar 4 08:55:17 CET 2014


 plugins/libcalendaring/libvcalendar.php                  |    6 +++++-
 plugins/libcalendaring/tests/resources/invalid-event.ics |    2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 65d603cd206dfc05189213f52991cfa67aa15f17
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Tue Mar 4 08:55:06 2014 +0100

    Allow all-day events without DTEND property

diff --git a/plugins/libcalendaring/libvcalendar.php b/plugins/libcalendaring/libvcalendar.php
index 0ce7902..674669d 100644
--- a/plugins/libcalendaring/libvcalendar.php
+++ b/plugins/libcalendaring/libvcalendar.php
@@ -545,8 +545,12 @@ class libvcalendar implements Iterator
                 $event['allday'] = true;
             }
 
+            // all-day events may lack the DTEND property
+            if ($event['allday'] && empty($event['end'])) {
+                $event['end'] = clone $event['start'];
+            }
             // shift end-date by one day (except Thunderbird)
-            if ($event['allday'] && is_object($event['end'])) {
+            else if ($event['allday'] && is_object($event['end'])) {
                 $event['end']->sub(new \DateInterval('PT23H'));
             }
 
diff --git a/plugins/libcalendaring/tests/resources/invalid-event.ics b/plugins/libcalendaring/tests/resources/invalid-event.ics
index 81602ae..f7200de 100644
--- a/plugins/libcalendaring/tests/resources/invalid-event.ics
+++ b/plugins/libcalendaring/tests/resources/invalid-event.ics
@@ -8,7 +8,7 @@ LAST-MODIFIED:20130755
 UID:C968B885-08FB-40E5-B89E-6FA05F26AACC
 TRANSP:TRANSPARENT
 SUMMARY:Event with no end date nor duration
-DTSTART;VALUE=DATE:20130801
+DTSTART;VALUE=DATE-TIME:20131001T120000Z
 SEQUENCE:2
 END:VEVENT
 END:VCALENDAR




More information about the commits mailing list