plugins/libcalendaring

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


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

New commits:
commit 1f27e238a82761a9ac6897b56b58d98d85637d2e
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 939cc76..bdf8dea 100644
--- a/plugins/libcalendaring/libvcalendar.php
+++ b/plugins/libcalendaring/libvcalendar.php
@@ -1214,8 +1214,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 d3a0ffe..ce4edea 100644
--- a/plugins/libcalendaring/tests/libvcalendar.php
+++ b/plugins/libcalendaring/tests/libvcalendar.php
@@ -523,8 +523,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