fix one problem if all recurrences of an event with explicit recurrences were overwritten/exceptions

This commit is contained in:
ralf 2024-06-04 16:44:59 +02:00
parent 66f40ee391
commit be1224276b
3 changed files with 15 additions and 4 deletions

View File

@ -184,6 +184,11 @@ class DateTime extends \DateTime
}
}
public function __toString()
{
return (string)$this->format(self::DATABASE);
}
/**
* Like DateTime::add, but additional allow to use a string run through DateInterval::createFromDateString
*

View File

@ -1417,8 +1417,11 @@ class calendar_boupdate extends calendar_bo
$occurrence = $rrule->current();
}
while ($rrule->validDate($event['whole_day']) && ($enddate = $occurrence));
$enddate->modify(($event['end'] - $event['start']).' second');
$event['recur_enddate'] = $save_event['recur_enddate'] = $enddate->format('ts');
if ($enddate)
{
$enddate->modify(($event['end'] - $event['start']).' second');
$event['recur_enddate'] = $enddate->format('ts');
}
//error_log(__METHOD__."($event[title]) start=".Api\DateTime::to($event['start'],'string').', end='.Api\DateTime::to($event['end'],'string').', range_end='.Api\DateTime::to($event['recur_enddate'],'string'));
}

View File

@ -597,9 +597,12 @@ class calendar_rrule implements Iterator
{
if ($this->type == self::PERIOD)
{
reset($this->period);
$this->current = clone reset($this->period);
}
else
{
$this->current = clone $this->time;
}
$this->current = clone $this->time;
while ($this->valid() &&
$this->exceptions &&
in_array($this->current->format('Ymd'),$this->exceptions))