From 50b1e6f4cc34f349e34c9749a7100fdc37a9cc31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Lehrke?= Date: Mon, 21 Jun 2010 17:48:48 +0000 Subject: [PATCH] Fix recurrence enddate for vCalendar 1.0, missing pieces --- calendar/inc/class.calendar_rrule.inc.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/calendar/inc/class.calendar_rrule.inc.php b/calendar/inc/class.calendar_rrule.inc.php index 95691b8d7e..48e2cd68d0 100644 --- a/calendar/inc/class.calendar_rrule.inc.php +++ b/calendar/inc/class.calendar_rrule.inc.php @@ -538,13 +538,6 @@ class calendar_rrule implements Iterator $repeat_days = array(); $rrule = array(); - if (!isset(self::$tz_cache['UTC'])) - { - self::$tz_cache['UTC'] = calendar_timezones::DateTimeZone('UTC'); - } - - $utc = self::$tz_cache['UTC']; - if ($this->type == self::NONE) return false; // no recuring event if ($version == '1.0') @@ -613,9 +606,15 @@ class calendar_rrule implements Iterator if ($this->enddate) { - $enddate = clone $this->enddate; - $enddate->setTimezone($utc); - $rrule['UNTIL'] = $enddate->format('Ymd\THis\Z'); + $this->rewind(); + $enddate = $this->current(); + do + { + $this->next_no_exception(); + $occurrence = $this->current(); + } + while ($this->valid() && ($enddate = $occurrence)); + $rrule['UNTIL'] = $enddate; } return $rrule;