Branch 'roundcubemail-plugins-kolab-3.1' - plugins/libcalendaring

Thomas Brüderli bruederli at kolabsys.com
Mon Sep 22 12:00:52 CEST 2014


 plugins/libcalendaring/libvcalendar.php       |    4 ++--
 plugins/libcalendaring/tests/libvcalendar.php |    4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 412bee468a6a4432edce47cafd07a8b64562666e
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Mon Sep 22 12:00:13 2014 +0200

    Fix TZOFFSET values with minutes (#3199)

diff --git a/plugins/libcalendaring/libvcalendar.php b/plugins/libcalendaring/libvcalendar.php
index 2a39aac..bb43388 100644
--- a/plugins/libcalendaring/libvcalendar.php
+++ b/plugins/libcalendaring/libvcalendar.php
@@ -1191,8 +1191,8 @@ class libvcalendar implements Iterator
                 $offset = $trans['offset'] / 3600;
 
                 $cmp->DTSTART = $dt->format('Ymd\THis');
-                $cmp->TZOFFSETFROM = sprintf('%s%02d%02d', $tzfrom >= 0 ? '+' : '', floor($tzfrom), 0);
-                $cmp->TZOFFSETTO   = sprintf('%s%02d%02d', $offset >= 0 ? '+' : '', floor($offset), 0);
+                $cmp->TZOFFSETFROM = sprintf('%s%02d%02d', $tzfrom >= 0 ? '+' : '', floor($tzfrom), ($tzfrom - floor($tzfrom)) * 60);
+                $cmp->TZOFFSETTO   = sprintf('%s%02d%02d', $offset >= 0 ? '+' : '', floor($offset), ($offset - floor($offset)) * 60);
 
                 if (!empty($trans['abbr'])) {
                     $cmp->TZNAME = $trans['abbr'];
diff --git a/plugins/libcalendaring/tests/libvcalendar.php b/plugins/libcalendaring/tests/libvcalendar.php
index a670d0c..4ea9ede 100644
--- a/plugins/libcalendaring/tests/libvcalendar.php
+++ b/plugins/libcalendaring/tests/libvcalendar.php
@@ -519,8 +519,10 @@ class libvcalendar_test extends PHPUnit_Framework_TestCase
         $this->assertEquals(false, $vtz);
 
         // DateTimezone as input data
-        $vtz = libvcalendar::get_vtimezone(new DateTimezone('Europe/Istanbul'));
+        $vtz = libvcalendar::get_vtimezone(new DateTimezone('Pacific/Chatham'));
         $this->assertInstanceOf('\Sabre\VObject\Component', $vtz);
+        $this->assertContains('TZOFFSETFROM:+1245', $vtz->serialize());
+        $this->assertContains('TZOFFSETTO:+1345', $vtz->serialize());
     }
 
     function get_attachment_data($id, $event)




More information about the commits mailing list