kopia lustrzana https://github.com/friendica/SG-iCalendar
fix recurrent events Between() query, could break $evt->getEnd() but not in these classes
rodzic
3181917e2c
commit
107781fe43
|
@ -18,6 +18,7 @@ class SG_iCal_VEvent {
|
||||||
private $uid;
|
private $uid;
|
||||||
private $start;
|
private $start;
|
||||||
private $end;
|
private $end;
|
||||||
|
private $lastend;
|
||||||
private $recurrence;
|
private $recurrence;
|
||||||
private $summary;
|
private $summary;
|
||||||
private $description;
|
private $description;
|
||||||
|
@ -52,7 +53,10 @@ class SG_iCal_VEvent {
|
||||||
$dur = new SG_iCal_Duration( $data['duration']->getData() );
|
$dur = new SG_iCal_Duration( $data['duration']->getData() );
|
||||||
$this->end = $this->start + $dur->getDuration();
|
$this->end = $this->start + $dur->getDuration();
|
||||||
unset($data['duration']);
|
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
|
//if there is a recurrence rule
|
||||||
$until = $this->recurrence->getUntil();
|
$until = $this->recurrence->getUntil();
|
||||||
$count = $this->recurrence->getCount();
|
$count = $this->recurrence->getCount();
|
||||||
|
@ -60,7 +64,7 @@ class SG_iCal_VEvent {
|
||||||
if ( $this->recurrence->getUntil() or $this->recurrence->getCount() ) {
|
if ( $this->recurrence->getUntil() or $this->recurrence->getCount() ) {
|
||||||
//if until is set, set that as the end date (using getTimeStamp)
|
//if until is set, set that as the end date (using getTimeStamp)
|
||||||
if ( $until ) {
|
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
|
//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
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getEnd() {
|
public function getEnd() {
|
||||||
return $this->end;
|
return max($this->end,$this->lastend);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Ładowanie…
Reference in New Issue