T5414: Fix wrong all-day event date in invitation box
This commit is contained in:
parent
de8e018c4a
commit
2f75ab5b39
3 changed files with 30 additions and 12 deletions
|
@ -2924,11 +2924,11 @@ class calendar extends rcube_plugin
|
||||||
$append = '';
|
$append = '';
|
||||||
|
|
||||||
// prepare a small agenda preview to be filled with actual event data on async request
|
// prepare a small agenda preview to be filled with actual event data on async request
|
||||||
if ($ical_objects->method == 'REQUEST') {
|
if ($ical_objects->method == 'REQUEST' && $event['start']) {
|
||||||
|
$date = $this->rc->format_date($event['start'], $this->rc->config->get('date_format'), empty($event['start']->_dateonly));
|
||||||
$append = html::div('calendar-agenda-preview',
|
$append = html::div('calendar-agenda-preview',
|
||||||
html::tag('h3', 'preview-title', $this->gettext('agenda') . ' ' .
|
html::tag('h3', 'preview-title', $this->gettext('agenda') . ' ' . html::span('date', $date))
|
||||||
html::span('date', $this->rc->format_date($event['start'], $this->rc->config->get('date_format')))
|
. '%before%' . $this->mail_agenda_event_row($event, 'current') . '%after%');
|
||||||
) . '%before%' . $this->mail_agenda_event_row($event, 'current') . '%after%');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$html .= html::div('calendar-invitebox invitebox boxinformation',
|
$html .= html::div('calendar-invitebox invitebox boxinformation',
|
||||||
|
|
|
@ -315,8 +315,8 @@ class libcalendaring extends rcube_plugin
|
||||||
$time_format = self::to_php_date_format($this->rc->config->get('calendar_time_format', $this->defaults['calendar_time_format']));
|
$time_format = self::to_php_date_format($this->rc->config->get('calendar_time_format', $this->defaults['calendar_time_format']));
|
||||||
|
|
||||||
if ($event['allday']) {
|
if ($event['allday']) {
|
||||||
$fromto = $this->rc->format_date($event['start'], $date_format);
|
$fromto = $this->rc->format_date($event['start'], $date_format, false);
|
||||||
if (($todate = $this->rc->format_date($event['end'], $date_format)) != $fromto)
|
if (($todate = $this->rc->format_date($event['end'], $date_format, false)) != $fromto)
|
||||||
$fromto .= ' - ' . $todate;
|
$fromto .= ' - ' . $todate;
|
||||||
}
|
}
|
||||||
else if ($duration < 86400 && $event['start']->format('d') == $event['end']->format('d')) {
|
else if ($duration < 86400 && $event['start']->format('d') == $event['end']->format('d')) {
|
||||||
|
|
|
@ -430,7 +430,7 @@ class libvcalendar implements Iterator
|
||||||
case 'DTEND':
|
case 'DTEND':
|
||||||
case 'DUE':
|
case 'DUE':
|
||||||
$propmap = array('DTSTART' => 'start', 'DTEND' => 'end', 'DUE' => 'due');
|
$propmap = array('DTSTART' => 'start', 'DTEND' => 'end', 'DUE' => 'due');
|
||||||
$event[$propmap[$prop->name]] = self::convert_datetime($prop);
|
$event[$propmap[$prop->name]] = self::convert_datetime($prop);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'TRANSP':
|
case 'TRANSP':
|
||||||
|
@ -694,16 +694,14 @@ class libvcalendar implements Iterator
|
||||||
|
|
||||||
// assign current timezone to event start/end
|
// assign current timezone to event start/end
|
||||||
if ($event['start'] instanceof DateTime) {
|
if ($event['start'] instanceof DateTime) {
|
||||||
if ($this->timezone)
|
$this->_apply_timezone($event['start']);
|
||||||
$event['start']->setTimezone($this->timezone);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
unset($event['start']);
|
unset($event['start']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($event['end'] instanceof DateTime) {
|
if ($event['end'] instanceof DateTime) {
|
||||||
if ($this->timezone)
|
$this->_apply_timezone($event['end']);
|
||||||
$event['end']->setTimezone($this->timezone);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
unset($event['end']);
|
unset($event['end']);
|
||||||
|
@ -728,6 +726,27 @@ class libvcalendar implements Iterator
|
||||||
return $event;
|
return $event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply user timezone to DateTime object
|
||||||
|
*/
|
||||||
|
private function _apply_timezone(&$date)
|
||||||
|
{
|
||||||
|
if (empty($this->timezone)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For date-only we'll keep the date and time intact
|
||||||
|
if ($date->_dateonly) {
|
||||||
|
$dt = new DateTime(null, $this->timezone);
|
||||||
|
$dt->setDate($date->format('Y'), $date->format('n'), $date->format('j'));
|
||||||
|
$dt->setTime($date->format('G'), $date->format('i'), 0);
|
||||||
|
$date = $dt;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$date->setTimezone($this->timezone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the given vfreebusy component into an array representation
|
* Parse the given vfreebusy component into an array representation
|
||||||
*/
|
*/
|
||||||
|
@ -816,7 +835,6 @@ class libvcalendar implements Iterator
|
||||||
if (empty($prop)) {
|
if (empty($prop)) {
|
||||||
return $as_array ? array() : null;
|
return $as_array ? array() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($prop instanceof VObject\Property\iCalendar\DateTime) {
|
else if ($prop instanceof VObject\Property\iCalendar\DateTime) {
|
||||||
if (count($prop->getDateTimes()) > 1) {
|
if (count($prop->getDateTimes()) > 1) {
|
||||||
$dt = array();
|
$dt = array();
|
||||||
|
|
Loading…
Add table
Reference in a new issue