Don't set timezone on allday dates (#2463)

This commit is contained in:
Thomas Bruederli 2013-11-01 11:23:42 +01:00
parent 5f3c4106a4
commit 875a76c801
2 changed files with 5 additions and 5 deletions

View file

@ -1275,7 +1275,7 @@ class calendar extends rcube_plugin
if ($event['recurrence']) { if ($event['recurrence']) {
$event['recurrence_text'] = $this->_recurrence_text($event['recurrence']); $event['recurrence_text'] = $this->_recurrence_text($event['recurrence']);
if ($event['recurrence']['UNTIL']) 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');
unset($event['recurrence']['EXCEPTIONS']); unset($event['recurrence']['EXCEPTIONS']);
} }
@ -1306,8 +1306,8 @@ class calendar extends rcube_plugin
return array( return array(
'_id' => $event['calendar'] . ':' . $event['id'], // unique identifier for fullcalendar '_id' => $event['calendar'] . ':' . $event['id'], // unique identifier for fullcalendar
'start' => $this->lib->adjust_timezone($event['start'])->format('c'), 'start' => $this->lib->adjust_timezone($event['start'], $event['allday'])->format('c'),
'end' => $this->lib->adjust_timezone($event['end'])->format('c'), 'end' => $this->lib->adjust_timezone($event['end'], $event['allday'])->format('c'),
// 'changed' might be empty for event recurrences (Bug #2185) // 'changed' might be empty for event recurrences (Bug #2185)
'changed' => $event['changed'] ? $this->lib->adjust_timezone($event['changed'])->format('c') : null, 'changed' => $event['changed'] ? $this->lib->adjust_timezone($event['changed'])->format('c') : null,
'title' => strval($event['title']), 'title' => strval($event['title']),

View file

@ -120,14 +120,14 @@ class libcalendaring extends rcube_plugin
* @param mixed Any kind of a date representation (DateTime object, string or unix timestamp) * @param mixed Any kind of a date representation (DateTime object, string or unix timestamp)
* @return object DateTime object in user's timezone * @return object DateTime object in user's timezone
*/ */
public function adjust_timezone($dt) public function adjust_timezone($dt, $dateonly = false)
{ {
if (is_numeric($dt)) if (is_numeric($dt))
$dt = new DateTime('@'.$dt); $dt = new DateTime('@'.$dt);
else if (is_string($dt)) else if (is_string($dt))
$dt = new DateTime($dt); $dt = new DateTime($dt);
if ($dt instanceof DateTime) { if ($dt instanceof DateTime && !($dt->_dateonly || $dateonly)) {
$dt->setTimezone($this->timezone); $dt->setTimezone($this->timezone);
} }