ics-parser icon indicating copy to clipboard operation
ics-parser copied to clipboard

Event recurrences appear twice if moved

Open sergentrif opened this issue 1 year ago • 2 comments

PHP Version

8.3

PHP date.timezone

Europe/Paris

ICS Parser Version

3.4

Operating System

Mac

Description

I moved the recurrence of an event and now this recurrence appears twice in the events that are loaded.

It first appears on the correct date (the last, after moving), but it still appears on its initial date.

My event is as follows

BEGIN:VEVENT
DTSTART;TZID=Europe/Paris:20240910T140000
DTEND;TZID=Europe/Paris:20240910T173000
DTSTAMP:20240912T131820Z
UID:FAKE-UID
RECURRENCE-ID;TZID=Europe/Paris:20240911T090000
CREATED:20240311T155453Z
LAST-MODIFIED:20240911T162406Z
SEQUENCE:3
STATUS:CONFIRMED
SUMMARY: FAKE-NAME
TRANSP:OPAQUE
CATEGORIES:2
END:VEVENT

Lines 1307 and 1308 of the ICal.php file seem suspicious to me, as they imply that we're going to replace the DTSTART date of the recurrence with the date contained in the RECURRENCE-ID field.

protected function processEvents()
{
    ...        
    $recurrenceDateUtc = $this->iCalDateToUnixTimestamp($anEvent['RECURRENCE-ID_array'][3]);
    $this->alteredRecurrenceInstances[$uid][$key] = $recurrenceDateUtc;
    ...
}

However, this initial date is now just an ID, since the recurrence has been moved. Even if these lines are modified, the problem remains. No matter how hard I try, I have to admit that I'm powerless to fix this bug.

Steps to Reproduce

You can use the following event

BEGIN:VEVENT
DTSTART;TZID=Europe/Paris:20240910T140000
DTEND;TZID=Europe/Paris:20240910T173000
DTSTAMP:20240912T131820Z
UID:FAKE-UID
RECURRENCE-ID;TZID=Europe/Paris:20240911T090000
CREATED:20240311T155453Z
LAST-MODIFIED:20240911T162406Z
SEQUENCE:3
STATUS:CONFIRMED
SUMMARY: FAKE-NAME
TRANSP:OPAQUE
CATEGORIES:2
END:VEVENT

sergentrif avatar Sep 12 '24 14:09 sergentrif

@s0600204: hello, if you feel up for it, I'd welcome your input.

u01jmg3 avatar Feb 25 '25 15:02 u01jmg3

Hi, I took some time to find a fix but unfortunately, I did not succeed...

sergentrif avatar Feb 25 '25 15:02 sergentrif