plugins/libcalendaring

Thomas Brüderli bruederli at kolabsys.com
Mon Mar 9 15:40:36 CET 2015


 plugins/libcalendaring/libcalendaring.php |   13 +++++++++----
 plugins/libcalendaring/libvcalendar.php   |    2 +-
 2 files changed, 10 insertions(+), 5 deletions(-)

New commits:
commit 3702557dc3cc0da27309b6214d7aa2ad75125b15
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Mon Mar 9 15:40:15 2015 +0100

    Export recurrence UNTIL parameter as DATE for all-day events (#3998)

diff --git a/plugins/libcalendaring/libcalendaring.php b/plugins/libcalendaring/libcalendaring.php
index 698fb68..4f277cf 100644
--- a/plugins/libcalendaring/libcalendaring.php
+++ b/plugins/libcalendaring/libcalendaring.php
@@ -1501,7 +1501,7 @@ class libcalendaring extends rcube_plugin
     /**
      * Convert the internal structured data into a vcalendar rrule 2.0 string
      */
-    public static function to_rrule($recurrence)
+    public static function to_rrule($recurrence, $allday = false)
     {
         if (is_string($recurrence))
             return $recurrence;
@@ -1513,9 +1513,14 @@ class libcalendaring extends rcube_plugin
             case 'UNTIL':
                 // convert to UTC according to RFC 5545
                 if (is_a($val, 'DateTime')) {
-                    $until = clone $val;
-                    $until->setTimezone(new DateTimeZone('UTC'));
-                    $val = $until->format('Ymd\THis\Z');
+                    if (!$allday && !$val->_dateonly) {
+                        $until = clone $val;
+                        $until->setTimezone(new DateTimeZone('UTC'));
+                        $val = $until->format('Ymd\THis\Z');
+                    }
+                    else {
+                        $val = $val->format('Ymd');
+                    }
                 }
                 break;
             case 'RDATE':
diff --git a/plugins/libcalendaring/libvcalendar.php b/plugins/libcalendaring/libvcalendar.php
index 195f99d..62ce19f 100644
--- a/plugins/libcalendaring/libvcalendar.php
+++ b/plugins/libcalendaring/libvcalendar.php
@@ -993,7 +993,7 @@ class libvcalendar implements Iterator
             }
 
             if ($event['recurrence']['FREQ']) {
-                $ve->add('RRULE', libcalendaring::to_rrule($event['recurrence']));
+                $ve->add('RRULE', libcalendaring::to_rrule($event['recurrence'], (bool)$event['allday']));
             }
 
             // add EXDATEs each one per line (for Thunderbird Lightning)




More information about the commits mailing list