From fe3bcb5fe2acfdddde52b849a7ce8cf8a02c2e6a Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Thu, 1 Mar 2012 20:50:00 +0100 Subject: [PATCH] Calendar: fix bug in creating DTEND from DTSTART --- apps/calendar/ajax/events.php | 2 +- apps/calendar/lib/object.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/calendar/ajax/events.php b/apps/calendar/ajax/events.php index 1436f63431..098e539a2d 100755 --- a/apps/calendar/ajax/events.php +++ b/apps/calendar/ajax/events.php @@ -44,8 +44,8 @@ foreach($events as $event){ $return_event = create_return_event($event, $vevent); $dtstart = $vevent->DTSTART; - $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent); $start_dt = $dtstart->getDateTime(); + $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent); $end_dt = $dtend->getDateTime(); if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE){ $return_event['allDay'] = true; diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php index 230c610d35..b84e575bc8 100644 --- a/apps/calendar/lib/object.php +++ b/apps/calendar/lib/object.php @@ -309,6 +309,8 @@ class OC_Calendar_Object{ $dtend = $vevent->DTEND; }else{ $dtend = clone $vevent->DTSTART; + // clone creates a shallow copy, also clone DateTime + $dtend->setDateTime(clone $dtend->getDateTime(), $dtend->getDateType()); if ($vevent->DURATION){ $duration = strval($vevent->DURATION); $invert = 0; @@ -817,4 +819,4 @@ class OC_Calendar_Object{ return $vcalendar; } -} \ No newline at end of file +}