fix allday bug
This commit is contained in:
parent
92fa6f0a48
commit
d50b014aba
|
@ -25,23 +25,26 @@ foreach($events as $event)
|
||||||
$dtstart = $vevent->DTSTART;
|
$dtstart = $vevent->DTSTART;
|
||||||
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
|
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
|
||||||
$start_dt = $dtstart->getDateTime();
|
$start_dt = $dtstart->getDateTime();
|
||||||
$start_dt->setTimezone(new DateTimeZone($user_timezone));
|
|
||||||
$end_dt = $dtend->getDateTime();
|
$end_dt = $dtend->getDateTime();
|
||||||
|
if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE)
|
||||||
|
{
|
||||||
|
$return_event['allDay'] = true;
|
||||||
|
$return_event['start'] = $start_dt->format('Y-m-d');
|
||||||
|
$end_dt->modify('-1 sec');
|
||||||
|
$return_event['end'] = $end_dt->format('Y-m-d');
|
||||||
|
}else{
|
||||||
|
$start_dt->setTimezone(new DateTimeZone($user_timezone));
|
||||||
$end_dt->setTimezone(new DateTimeZone($user_timezone));
|
$end_dt->setTimezone(new DateTimeZone($user_timezone));
|
||||||
|
$return_event['start'] = $start_dt->format('Y-m-d H:i:s');
|
||||||
|
$return_event['end'] = $end_dt->format('Y-m-d H:i:s');
|
||||||
|
$return_event['allDay'] = false;
|
||||||
|
}
|
||||||
$return_event = array();
|
$return_event = array();
|
||||||
$return_event['id'] = $event['id'];
|
$return_event['id'] = $event['id'];
|
||||||
$return_event['title'] = $event['summary'];
|
$return_event['title'] = $event['summary'];
|
||||||
$return_event['description'] = isset($vevent->DESCRIPTION)?$vevent->DESCRIPTION->value:'';
|
$return_event['description'] = isset($vevent->DESCRIPTION)?$vevent->DESCRIPTION->value:'';
|
||||||
$return_event['start'] = $start_dt->format('Y-m-d H:i:s');
|
$return_event['start'] = $start_dt->format('Y-m-d H:i:s');
|
||||||
$return_event['end'] = $end_dt->format('Y-m-d H:i:s');
|
$return_event['end'] = $end_dt->format('Y-m-d H:i:s');
|
||||||
$return_event['allDay'] = false;
|
|
||||||
if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE)
|
|
||||||
{
|
|
||||||
$return_event['allDay'] = true;
|
|
||||||
$end_dt->modify('-1 sec');
|
|
||||||
$return_event['end'] = $end_dt->format('Y-m-d H:i:s');
|
|
||||||
}
|
|
||||||
$return[] = $return_event;
|
$return[] = $return_event;
|
||||||
}
|
}
|
||||||
OC_JSON::encodedPrint($return);
|
OC_JSON::encodedPrint($return);
|
||||||
|
|
Loading…
Reference in New Issue