summaryrefslogtreecommitdiffstats
path: root/apps/calendar/lib/object.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/calendar/lib/object.php')
-rw-r--r--apps/calendar/lib/object.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php
index 0c7649776d5..0c3e497d4f2 100644
--- a/apps/calendar/lib/object.php
+++ b/apps/calendar/lib/object.php
@@ -286,6 +286,30 @@ class OC_Calendar_Object{
}
}
+ public static function getDTEndFromVEvent($vevent)
+ {
+ if ($vevent->DTEND) {
+ $dtend = $vevent->DTEND;
+ }else{
+ $dtend = clone $vevent->DTSTART;
+ if ($vevent->DURATION){
+ $duration = strval($vevent->DURATION);
+ $invert = 0;
+ if ($duration[0] == '-'){
+ $duration = substr($duration, 1);
+ $invert = 1;
+ }
+ if ($duration[0] == '+'){
+ $duration = substr($duration, 1);
+ }
+ $interval = new DateInterval($duration);
+ $interval->invert = $invert;
+ $dtend->getDateTime()->add($interval);
+ }
+ }
+ return $dtend;
+ }
+
public static function getCategoryOptions($l10n)
{
return array(
@@ -482,6 +506,7 @@ class OC_Calendar_Object{
}
$vevent->DTSTART = $dtstart;
$vevent->DTEND = $dtend;
+ unset($vevent->DURATION);
if($location != ""){
$vevent->LOCATION = $location;