laravel-calendar-events icon indicating copy to clipboard operation
laravel-calendar-events copied to clipboard

[Bug] Recurrences dates are not right

Open buddy94 opened this issue 2 years ago • 0 comments

I found that if I create an event with:

[
'recurring_type' => RecurringFrequencyType::RECURRING_TYPE_DAILY,
     'repeat_interval' => 15, 
     'repeat_by_days' => [], 
     'repeat_by_months' => [],
    'max_occurrences' => null, 
]

When i call the function getEventsBetween the dates of the recurrences of the event are wrong.

From what I understood the function $this->getNextEvents($numberOfEvents); generate the recurrences starting from the original event date. The problem is that in the function getEventsBetween, before calling getNextEvents() the starting date is changed with the starting date of the period that the user need:

if ($startDate > $this->start_date) {
            $this->start_date = Carbon::parse($startDate);
        }

Then when calling getNextEvents() all the events date are wrong.

If I delete this line:

if ($startDate > $this->start_date) {
            $this->start_date = Carbon::parse($startDate);
        }

everything works fine, but then I have performances issues.

Thanks in advance

buddy94 avatar Mar 15 '23 14:03 buddy94