ics-parser: Duplicate event for recurring meeting instance exception
- PHP Version:
5.6.30
- PHP date.timezone:
America/New_York
Description of the Issue:
Duplicate meetings for recurring meetings. This happens on meetings that have single occurrences that have different times.
Steps to Reproduce:
Example iCal from Zimbra. On 20/04/2017 there should be 2x 1 hour meetings at 9:00 and 15:30 14:00. Instead 4x 3x meetings are returned. Two One is a duplicate.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 30 (15 by maintainers)
Commits related to this issue
- RE: #129 - when converting an event date to a UNIX timestamp only apply the event time zone if explicitly requested — committed to u01jmg3/ics-parser by u01jmg3 7 years ago
- Alter recurrence matching logic to support events with time zone data Enhance Event object to provide access to the ICal object and its functions — committed to u01jmg3/ics-parser by u01jmg3 7 years ago
- Merge pull request #142 from u01jmg3/issue-129 Changes to address issue #129 — committed to u01jmg3/ics-parser by u01jmg3 7 years ago
$ical->iCalDateToDateTime($event->dtstart_array[3], $forceTimeZone = true)
prevent you having to apply the time zone?DateTime
object.v3.0.0
,iCalDateToUnixTimestamp()
will still be available but I would recommend moving toDateTime
objects in the meantime.Appreciate the compliment.
Cast your eye over PR #142 and see what you think - made some final changes to refactor and improve the code I had already written but essentially it achieves the same thing and addresses the issues you raised.
You may see some code that looks repetitive and not as neat as it could be - at this point I don’t want to introduce any breaking changes to the parser but eventually I will bump to
v3.0.0
and take the hit.Makes sense… and it’s easy to switch the default value later. I think the variable name works and I can set it to true for our parsing needs. It corrects all the parsing errors I’ve seen in the last month. This is the most complete ical parser I found for PHP. I’ve tried several, all with different problems.
I like how you extended the class to include the TZ. That’s the part I hadn’t looked closely enough on how you were handling TZ within recurrences; I guess you weren’t. I wasn’t sure how best to implement that either and like your solution.
Been through your examples and made numerous changes in a separate branch to correct the issues you found
Gist of it is, you can now get the UNIX timestamp you are looking for when iterating through the events using:
I have also corrected the logic for matching recurrence events by making the comparison aware of time zone data - goodbye dupes
Updated with a readme … hopefully, illustrates the wrong timestamp set
Thanks for your efforts - your patch actually crashes my SourceTree but opening in an editor I get the gist of your change. Still working on an effective resolution. Hope to have something soon.