From 107781fe43dd8330a5a07b5f8e5fbb8898be9655 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Fri, 29 Oct 2010 05:02:17 +0200 Subject: [PATCH] fix recurrent events Between() query, could break $evt->getEnd() but not in these classes --- blocks/SG_iCal_VEvent.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/blocks/SG_iCal_VEvent.php b/blocks/SG_iCal_VEvent.php index d7f68b3..8959fb0 100755 --- a/blocks/SG_iCal_VEvent.php +++ b/blocks/SG_iCal_VEvent.php @@ -18,6 +18,7 @@ class SG_iCal_VEvent { private $uid; private $start; private $end; + private $lastend; private $recurrence; private $summary; private $description; @@ -52,7 +53,10 @@ class SG_iCal_VEvent { $dur = new SG_iCal_Duration( $data['duration']->getData() ); $this->end = $this->start + $dur->getDuration(); unset($data['duration']); - } elseif ( isset($this->recurrence) ) { + } + + //google cal set dtend as end of initial event + if ( isset($this->recurrence) ) { //if there is a recurrence rule $until = $this->recurrence->getUntil(); $count = $this->recurrence->getCount(); @@ -60,7 +64,7 @@ class SG_iCal_VEvent { if ( $this->recurrence->getUntil() or $this->recurrence->getCount() ) { //if until is set, set that as the end date (using getTimeStamp) if ( $until ) { - $this->end = strtotime( $until ); + $this->lastend = strtotime( $until ); } //if count is set, then figure out the last occurrence and set that as the end date } @@ -143,7 +147,7 @@ class SG_iCal_VEvent { * @return int */ public function getEnd() { - return $this->end; + return max($this->end,$this->lastend); } /**