Summary | Wrong timezone calculation with CalDAV |
Queue | Horde Framework Packages |
Queue Version | Git master |
Type | Bug |
State | Resolved |
Priority | 1. Low |
Owners | jan (at) horde (dot) org, mrubinsk (at) horde (dot) org |
Requester | nicolas (at) deffayet (dot) com |
Created | 11/18/2013 (4254 days ago) |
Due | |
Updated | 02/12/2014 (4168 days ago) |
Assigned | 02/11/2014 (4169 days ago) |
Resolved | 02/12/2014 (4168 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
State ⇒ Resolved
release, independent on the Horde version.
Queue ⇒ Horde Framework Packages
Any chance it will be backported to 5.1? Or should I create an own
pull-request?
State ⇒ Feedback
Taken from
Assigned to Jan Schneider
commit 23ca03c1902391b36e30dcd4d473e3f6ee50ce45
Author: Jan Schneider <jan@horde.org>
Date: Tue Feb 11 18:18:04 2014 +0100
Revert "Add currently failing test for
Bug: 12843"Bug is in Horde_Date.
This reverts commit 29ee3502dacc8fba07c7b355dbe60dbbf0e5e7d1.
framework/Icalendar/package.xml | 9 +--
.../Icalendar/test/Horde/Icalendar/DateTest.php | 50
--------------------
.../test/Horde/Icalendar/fixtures/
bug12843.ics | 41 ----------------3 files changed, 3 insertions(+), 97 deletions(-)
http://git.horde.org/horde-git/-/commit/23ca03c1902391b36e30dcd4d473e3f6ee50ce45
commit 5eb27a0b1b12c99226ff819d4ce0f5c8e66e3c08
Author: Jan Schneider <jan@horde.org>
Date: Tue Feb 11 18:13:04 2014 +0100
Fix date calculation if providing both a timestamp and a timezone.
We need to temporarily set the timezone to the one provided in
the contructor,
because the result of getdate() depends on the current default
timezone. It's
probably the only method in the whole world that does this.
Bug: 12843framework/Date/lib/Horde/Date.php | 7 +++++++
framework/Date/package.xml | 2 ++
framework/Date/test/Horde/Date/DateTest.php | 10 ++++++++++
3 files changed, 19 insertions(+), 0 deletions(-)
http://git.horde.org/horde-git/-/commit/5eb27a0b1b12c99226ff819d4ce0f5c8e66e3c08
commit 29ee3502dacc8fba07c7b355dbe60dbbf0e5e7d1
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date: Tue Feb 11 10:39:50 2014 -0500
Add currently failing test for
Bug: 12843framework/Icalendar/package.xml | 9 ++-
.../Icalendar/test/Horde/Icalendar/DateTest.php | 50
++++++++++++++++++++
.../test/Horde/Icalendar/fixtures/
bug12843.ics | 41 ++++++++++++++++3 files changed, 97 insertions(+), 3 deletions(-)
http://git.horde.org/horde-git/-/commit/29ee3502dacc8fba07c7b355dbe60dbbf0e5e7d1
Assigned to
State ⇒ Assigned
Assigned to Michael Rubinsky
isolated unit test. Now, I have to figure out why the import is
working for me locally to see if I can track down the correct fix.
and we end up with 2times converting to UTC
1. in _parseDateTime($text, $tzid = false) in Icalendar.php
2. in toProperties($full = false) in kronolith/lib/Event/Sql.php
This is one time to much!
I would propose to skip the UTC converting in Icalendar.php Not sure
what it would break but why not having $time['zone'] already set to
the correct timezone and not "Local"
Or why do we need to convert the timezones there if we anyway convert
again while saving?
New Attachment: berlin 10.ics
Here is what I got:
I'm importing the attached ics. That's the way lighning sends its data.
The main data is:
DTSTART;TZID=Europe/Berlin:20140205T100000
DTEND;TZID=Europe/Berlin:20140205T110000
So here what happends in the code
In framework/Icalendar/lib/Horde/Icalendar.php line 1296
$time = $this->_parseTime($dateParts[1])
is called
it gets $dateParts[1] what has the correct value of 100000
and it returns:
$time Array [4]
hour 10
minute 00
second 00
zone Local
In the next lines $this->_parseTZID($date, $time, $tzid) is called
that returns
$tzoffset 3600
That offset is substracted from the calculated time, what gives us the
correct time in UTC
But when we came back to line 681 In
framework/Icalendar/lib/Horde/Icalendar.php and set the attribute with
$this->setAttribute($tag, $this->_parseDateTime($ts[0], $tzid), $params);
We end up with an Object that looks like:
$this Horde_Icalendar_Vevent
CLASSNAME Horde_Icalendar_Vevent
type vEvent
_container Horde_Icalendar
_attributes Array [7]
0 Array [4]
1 Array [4]
2 Array [4]
3 Array [4]
4 Array [4]
5 Array [4]
name DTSTART
params Array [1]
TZID Europe/Berlin
value 1391590800
values Array [1]
6 Array [4]
_components Array [0]
_newline
_version 2.0
_oldFormat false
So we have the time in UTC but TZID set to Europe/Berlin
That object get passed back the whole way to kronolith/data.php line 90
$next_step = $data->nextStep($actionID, $param);
So in the database I end up with and event that looks like:
event_start 2014-02-05 08:00:00
event_end 2014-02-05 08:59:59
event_timezone Europe/Berlin
It looks like before the event get saved it get coonverted to UTC again
That's with
$conf['calendar']['params']['utc'] = true;
$conf['resource']['params']['utc'] = true;
If I set both values to false I end up in the database with:
event_start 2014-02-05 09:00:00
event_end 2014-02-05 09:59:59
event_timezone Europe/Berlin
So my quick fix is simple to disable the $tzoffset calculation. and
set it to false. (I know this is not really a fix of the problem)
Without that fix I can just add events correctly from lightning that
are in the same timezone as set in horde under Global Preferences ->
Local and Time
With that fix other timezones also work fine.
So far for now, will dig deeper.
Another problem is that the webinterface of kronolith seems to show
all events according to UTC, no matter what is set in the settings.
But I think that is not related.
Actually, let me clarify this. What I wrote above is what happens when
we import the already parsed iCalendar data into Kronolith. When the
iCalendar data is initially parsed though, the vTimezone is used to
determine the offsets from UTC. You can trace this yourself in
Horde_Icalendar:: to see where it is failing for you.
Can you please tell me how the timezone parsing is done in Horde
when importing ICS data ?
directly (assuming it's natively supported by PHP). We completely
ignore the VTIMEZONE component.
As you can see bellow, when timezone in TZID and X-LIC-LOCATION
lines are different than timezone in DTSTART and DTEND lines it works.
it's imported, but if the TZID attribute of DTSTART or DTEND is not
also present in a VTIMEZONE, it's not a valid iCalendar file.
As with Jan, this file imports correctly for me. Perhaps your timezone
database is outdated or corrupted? Either way, you will have to trace
this yourself as no developer can reproduce it.
I'm syncing with android CalDAV and Thunderbird/Lightning over CalDAV
to Horde via HTTPS.
The timezone of my Horde Calendar and my Devices are Asia/Kathmandu
If I create a new event in my local timezone everething is fine.
If I create a new event in a foreigh timezone with the web interface
everething is also fine.
But If I create in Thunderbird/Android an event in the foreign
timezone I get it back with the foreign timezone but the time is set
to what should be in my local timezone.
E.g. if I create a event for 8:00 in Europe/Berlin I get it back as
12:45 Europe/Berlin and 17:30 Asia/Kathmandu but it should be 12:45
Asia/Kathmandu
I'm using horde 5.1.1
An other user wrote about that same problem on the mailing list:
http://horde.690.n7.nabble.com/Timezone-change-after-synchronize-event-from-evolution-tt119034.html#none
Can you please tell me how the timezone parsing is done in Horde when
importing ICS data ?
Did Horde use TZID and/or X-LIC-LOCATION line or use only DTSTART/DTEND ?
As you can see bellow, when timezone in TZID and X-LIC-LOCATION lines
are different than timezone in DTSTART and DTEND lines it works.
--->
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//dmfs.org//mimedir.icalendar//EN
BEGIN:VTIMEZONE
TZID:Europe/Berlin
X-LIC-LOCATION:Europe/Berlin
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTART;TZID=Europe/Berlin:20131119T180000
DESCRIPTION:Some Description
SUMMARY:CalDAV-Sync Test Event
LOCATION:Some Location
TRANSP:OPAQUE
STATUS:CONFIRMED
DTEND;TZID=Europe/Berlin:20131119T190000
LAST-MODIFIED:20131118T133721Z
DTSTAMP:20131118T133721Z
CREATED:20131118T133721Z
UID:d9efd40a-39b5-4d62-9129-83ff649fa1a8
BEGIN:VALARM
TRIGGER;VALUE=DURATION:-PT10M
ACTION:DISPLAY
DESCRIPTION:Default Event Notification
X-WR-ALARMUID:45da49a7-9941-4ff9-8b27-b45c5c4c4c39
END:VALARM
END:VEVENT
END:VCALENDAR
--->
Show:
Event title: CalDAV-Sync Test Event
From 11/19/2013 17:00 to 11/19/2013 17:59 Timezone: Europe/Berlin
=> The date is converted but there is no reason to convert it as in
the ics file there is:
DTSTART;TZID=Europe/Berlin:20131119T180000
DTEND;TZID=Europe/Berlin:20131119T190000
Now, just do the following modification in the ICS file:
-DTSTART;TZID=Europe/Berlin:20131119T180000
+DTSTART;TZID=Europe/Paris:20131119T180000
-DTEND;TZID=Europe/Berlin:20131119T190000
+DTEND;TZID=Europe/Paris:20131119T190000
(and so keep Europe/Berlin for TZID and X-LIC-LOCATION.)
--->
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//dmfs.org//mimedir.icalendar//EN
BEGIN:VTIMEZONE
TZID:Europe/Berlin
X-LIC-LOCATION:Europe/Berlin
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTART;TZID=Europe/Paris:20131119T180000
DESCRIPTION:Some Description
SUMMARY:CalDAV-Sync Test Event
LOCATION:Some Location
TRANSP:OPAQUE
STATUS:CONFIRMED
DTEND;TZID=Europe/Paris:20131119T190000
LAST-MODIFIED:20131118T133721Z
DTSTAMP:20131118T133721Z
CREATED:20131118T133721Z
UID:d9efd40a-39b5-4d62-9129-83ff649fa1a8
BEGIN:VALARM
TRIGGER;VALUE=DURATION:-PT10M
ACTION:DISPLAY
DESCRIPTION:Default Event Notification
X-WR-ALARMUID:45da49a7-9941-4ff9-8b27-b45c5c4c4c39
END:VALARM
END:VEVENT
END:VCALENDAR
--->
Show:
Event title: CalDAV-Sync Test Event
From 11/19/2013 18:00 to 11/19/2013 18:59 Timezone: Europe/Paris
Of course, i have tried this two imports tests multiple times for be
sure of the result.
--->
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//dmfs.org//mimedir.icalendar//EN
BEGIN:VTIMEZONE
TZID:Europe/Berlin
X-LIC-LOCATION:Europe/Berlin
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTART;TZID=Europe/Berlin:20131119T180000
DESCRIPTION:Some Description
SUMMARY:CalDAV-Sync Test Event
LOCATION:Some Location
TRANSP:OPAQUE
STATUS:CONFIRMED
DTEND;TZID=Europe/Berlin:20131119T190000
LAST-MODIFIED:20131118T133721Z
DTSTAMP:20131118T133721Z
CREATED:20131118T133721Z
UID:d9efd40a-39b5-4d62-9129-83ff649fa1a8
BEGIN:VALARM
TRIGGER;VALUE=DURATION:-PT10M
ACTION:DISPLAY
DESCRIPTION:Default Event Notification
X-WR-ALARMUID:45da49a7-9941-4ff9-8b27-b45c5c4c4c39
END:VALARM
END:VEVENT
END:VCALENDAR
--->
My Calendars [edit] -> Import
Import ICS file
Did you see in the Web interface:
Event title: CalDAV-Sync Test Event
From 11/19/2013 17:00 to 11/19/2013 17:59 Timezone: Europe/Berlin
or
Event title: CalDAV-Sync Test Event
From 11/19/2013 18:00 to 11/19/2013 18:59 Timezone: Europe/Berlin
Thanks
installed? AFAIK all Samsung devices with Android 4.1 have Samsung's
S-Planner app instead.
Anyway, I tried both S-Planner on a Samsung device, and importing
your ics file directly. Both work perfectly fine with the correct
time.
file provided in this ticket in Horde (thanks for the tips to test
this) and Horde show wrong time in Web Interface and show wrong time
in ICS exported from Web Interface.
If you try to import the ICS in Horde:
My Calendars [edit] -> Import
Import ICS file
You will see:
Event title: CalDAV-Sync Test Event
From 11/19/2013 17:00 to 11/19/2013 17:59 Timezone: Europe/Berlin
For reminder, the event is 18:00 CET to 19:00 CET.
Now, if we compare the ICS format of the this event:
Imported ICS file to Horde:
DTSTART;TZID=Europe/Berlin:20131119T180000
DTEND;TZID=Europe/Berlin:20131119T190000
Exported ICS file from Horde:
DTSTART:20131119T160000Z
DTEND:20131119T170000Z
This is wrong, as Horde should have & export:
DTSTART:20131119T170000Z
DTEND:20131119T180000Z
I have tested timezone convertion in php (DateTime/ DateTimeZone with
the exemple
http://stackoverflow.com/questions/2505681/timezone-conversion-in-php)
and this works file, so php is not faulty on Horde server.
Thanks
installed? AFAIK all Samsung devices with Android 4.1 have Samsung's
S-Planner app instead.
Anyway, I tried both S-Planner on a Samsung device, and importing
your ics file directly. Both work perfectly fine with the correct
time.
About Calendar
Version 201306302
(c)2013 Google Inc.
I don't use Samsung apps.
Thanks
installed? AFAIK all Samsung devices with Android 4.1 have Samsung's
S-Planner app instead.
Anyway, I tried both S-Planner on a Samsung device, and importing your
ics file directly. Both work perfectly fine with the correct time.
alone Horde. There is no builtin CalDAV support in Android either.
You must be using a 3rd party application, if this is really about
CalDAV synchronization with Horde.
I use caldav-sync from dmfs (http://dmfs.org/caldav/) for exchange
Caldav data between Google Calendar and Horde.
Please find bellow the capture of what caldav-sync sent to Horde
(event is scheduled for today from 18:00 CET to 19:00 CET):
--->
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//dmfs.org//mimedir.icalendar//EN
BEGIN:VTIMEZONE
TZID:Europe/Berlin
X-LIC-LOCATION:Europe/Berlin
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTART;TZID=Europe/Berlin:20131119T180000
DESCRIPTION:Some Description
SUMMARY:CalDAV-Sync Test Event
LOCATION:Some Location
TRANSP:OPAQUE
STATUS:CONFIRMED
DTEND;TZID=Europe/Berlin:20131119T190000
LAST-MODIFIED:20131118T133721Z
DTSTAMP:20131118T133721Z
CREATED:20131118T133721Z
UID:d9efd40a-39b5-4d62-9129-83ff649fa1a8
BEGIN:VALARM
TRIGGER;VALUE=DURATION:-PT10M
ACTION:DISPLAY
DESCRIPTION:Default Event Notification
X-WR-ALARMUID:45da49a7-9941-4ff9-8b27-b45c5c4c4c39
END:VALARM
END:VEVENT
END:VCALENDAR
--->
Thanks
Horde. There is no builtin CalDAV support in Android either. You must
be using a 3rd party application, if this is really about CalDAV
synchronization with Horde.
it sends, with wireshark or similar?
Local time zone is GMT+1
I don't have any tools for listen what it send. The traffic is over HTTPS.
Is it possible to enable something on Horde side for log to a file
what Horde receive from Android device and what Horde do (timezone
calculation, etc...) ?
Did some settings can be set in PHP files for avoid to enable full
global verbose debug that generate a lot of data ?
Thanks
State ⇒ Feedback
Priority ⇒ 1. Low
it sends, with wireshark or similar?
Priority ⇒ 3. High
State ⇒ Unconfirmed
Patch ⇒ No
Milestone ⇒
Summary ⇒ Wrong timezone calculation with CalDAV
Type ⇒ Bug
Queue ⇒ Kronolith
Horde Webmail Groupware (last version)
The server store data using UTC.
Webinterface used.
Android device:
Samsung Galaxy Note 2 (4.1.2) stock image)
Local time zone is GMT+1
Google Calendar used as calendar app.
Evolution -> Horde -> Android
-----------------------------
I have created a new appoitement in Evolution (gnome.org mail
application) on 18th: 12h Europe/Paris = 11h UTC
Evolution send the time in UTC format to Horde (don't know why).
DTSTART:20131118T110000Z
DTEND:20131118T113000Z
In Evolution: show 11h UTC
In Horde: show 11h UTC
In Android: show 12h CET
=> In this direction everything is fine.
Android -> Horde -> Evolution
-----------------------------
But now, when i created a new appoitement in Android on 18h: 14h
Europe/Paris aka CET = 13h UTC
Horde ics data:
DTSTART:20131118T120000Z
DTEND:20131118T130000Z
In Evolution: show 12h UTC
=> This is wrong! It should be 13h UTC.
In Horde: show 12h UTC
=> This is wrong! It should be 13h UTC.
In Android: show 13h CET
=> This is wrong! It should be 14h CET.
In this direction there is an issue.
For know if the issue is related to timezone or summer-time, i created
a new appoitement in Android on 18th: 15h America/New_York (Eastern
Standard Time GMT-5) = 20h UTC
Horde ics data:
DTSTART:20131119T010000Z
DTEND:20131119T020000Z
In Horde: show 01h UTC of 19th -- 20h America/New_York of 18th
=> This is wrong! It should be 20h UTC of 18h.
In Android: show 02h CET of 19th
=> This is wrong! It should be 21h CET of 18th.