[Kolab-devel] Possible bug in generated calendar invitations

Steve Teti <[email protected]>
Newsgroups gmane.comp.kde.devel.kolab
Message-ID <[email protected]>
Hello,

I think there's a problem with invalid timezone information (VTIMEZONE) 
in event invitations - specifically with the TZOFFSETFROM and TZOFFSETTO 
for timezones with negative UTC offsets.  When I create a new calendar 
event, the VTIMEZONE data in the generated invitation looks like this:

BEGIN:VTIMEZONE
TZID:America/New_York
X-MICROSOFT-CDO-TZID:10
BEGIN:STANDARD
DTSTART:20141102T060000
TZOFFSETFROM:-400
TZOFFSETTO:-500
TZNAME:EST
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:20150308T070000
TZOFFSETFROM:-500
TZOFFSETTO:-400
TZNAME:EDT
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:20151101T060000
TZOFFSETFROM:-400
TZOFFSETTO:-500
TZNAME:EST
END:STANDARD
END:VTIMEZONE

Note specifically that the TZOFFSETFROM and TZOFFSETTO are formatted 
without a leading zero.  This problem does not exist for timezones with 
a positive UTC offset - it only manifests for those with a negative 
offset.  Some clients, such as Lightning and Outlook, seem to handle 
this OK.  Other clients (Gmail was the one I found the issue on) do not 
recognize the event invitation at all.  The validator at 
http://severinghaus.org/projects/icv/ throws an error stating "Invalid 
UTC offset [-400] - must be of the form: (+/-)HHMM[SS]".

I have attached a patch for libcalendaring that fixes this issue in my 
deployment.

Thanks,
Steve

_______________________________________________
devel mailing list
[email protected]
https://lists.kolab.org/mailman/listinfo/devel
patch.txt (text/x-diff, 1.2 KB)
commit dddd8d00bb14e5cd75056f9ea0c6ab138d00605e
Author: root <[email protected]>
Date:   Wed Jun 3 11:48:23 2015 -0400

    Fixed bug in generating TZOFFSETFROM and TZOFFSETTO

diff --git a/plugins/libcalendaring/libvcalendar.php b/plugins/libcalendaring/libvcalendar.php
index 38441e0..df87df8 100644
--- a/plugins/libcalendaring/libvcalendar.php
+++ b/plugins/libcalendaring/libvcalendar.php
@@ -1303,8 +1303,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), ($tzfrom - floor($tzfrom)) * 60);
-                $cmp->TZOFFSETTO   = sprintf('%s%02d%02d', $offset >= 0 ? '+' : '', floor($offset), ($offset - floor($offset)) * 60);
+                $cmp->TZOFFSETFROM = sprintf('%s%02d%02d', $tzfrom >= 0 ? '+' : '-', abs(floor($tzfrom)), ($tzfrom - floor($tzfrom)) * 60);
+                $cmp->TZOFFSETTO   = sprintf('%s%02d%02d', $offset >= 0 ? '+' : '-', abs(floor($offset)), ($offset - floor($offset)) * 60);
 
                 if (!empty($trans['abbr'])) {
                     $cmp->TZNAME = $trans['abbr'];
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.