summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2013-11-01 10:23:42 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2013-11-01 10:32:17 (GMT)
commit9e141e91690d953e431b2a5f123a089a245c13a3 (patch)
tree2a0e7e50e291950ff3051523462eb99a27fb0f3c
parentde7ff3a25e736bf53682339b4a2d7ead15d86920 (diff)
downloadroundcubemail-plugins-kolab-9e141e91690d953e431b2a5f123a089a245c13a3.tar.gz
Don't set timezone on allday dates (#2463)roundcubemail-plugins-kolab-3.0
-rw-r--r--plugins/calendar/calendar.php8
-rw-r--r--plugins/libcalendaring/libcalendaring.php7
2 files changed, 10 insertions, 5 deletions
diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index 6eb5ca5..4ad2313 100644
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -1100,7 +1100,7 @@ class calendar extends rcube_plugin
if ($event['recurrence']) {
$event['recurrence_text'] = $this->_recurrence_text($event['recurrence']);
if ($event['recurrence']['UNTIL'])
- $event['recurrence']['UNTIL'] = $this->lib->adjust_timezone($event['recurrence']['UNTIL'])->format('c');
+ $event['recurrence']['UNTIL'] = $this->lib->adjust_timezone($event['recurrence']['UNTIL'], $event['allday'])->format('c');
}
foreach ((array)$event['attachments'] as $k => $attachment) {
@@ -1126,8 +1126,10 @@ class calendar extends rcube_plugin
return array(
'_id' => $event['calendar'] . ':' . $event['id'], // unique identifier for fullcalendar
- 'start' => $this->lib->adjust_timezone($event['start'])->format('c'),
- 'end' => $this->lib->adjust_timezone($event['end'])->format('c'),
+ 'start' => $this->lib->adjust_timezone($event['start'], $event['allday'])->format('c'),
+ 'end' => $this->lib->adjust_timezone($event['end'], $event['allday'])->format('c'),
+ // 'changed' might be empty for event recurrences (Bug #2185)
+ 'changed' => $event['changed'] ? $this->lib->adjust_timezone($event['changed'])->format('c') : null,
'title' => strval($event['title']),
'description' => strval($event['description']),
'location' => strval($event['location']),
diff --git a/plugins/libcalendaring/libcalendaring.php b/plugins/libcalendaring/libcalendaring.php
index 7451c8a..c7f7cff 100644
--- a/plugins/libcalendaring/libcalendaring.php
+++ b/plugins/libcalendaring/libcalendaring.php
@@ -104,14 +104,17 @@ class libcalendaring extends rcube_plugin
* @param mixed Any kind of a date representation (DateTime object, string or unix timestamp)
* @return object DateTime object in user's timezone
*/
- public function adjust_timezone($dt)
+ public function adjust_timezone($dt, $dateonly = false)
{
if (is_numeric($dt))
$dt = new DateTime('@'.$dt);
else if (is_string($dt))
$dt = new DateTime($dt);
- $dt->setTimezone($this->timezone);
+ if ($dt instanceof DateTime && !($dt->_dateonly || $dateonly)) {
+ $dt->setTimezone($this->timezone);
+ }
+
return $dt;
}