Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in SG_iCal_Freq #15

Open
yfedoruk opened this issue Apr 11, 2014 · 1 comment
Open

Bug in SG_iCal_Freq #15

yfedoruk opened this issue Apr 11, 2014 · 1 comment

Comments

@yfedoruk
Copy link

Hi, I found bug in helpers/SG_iCal_Freq.php in function findNext on line 264.

if( $imm > $offset && $imm < $eop && ($_t == null || $imm < $_t) ) {

I think, second condition must be $imm <= $eop
so as it is wrong recurrence in some cases. For example there is RRULE:
"FREQ=WEEKLY;COUNT=5;INTERVAL=1;BYDAY=SU,MO"
and start date for occurence is
"2014-04-06 00:00:00" and end date
"2014-04-06 01:00:00".
So for this RRULE and this start date function getAllOccurrences() gives us results:
string(19) "2014-04-06 00:00:00"
string(19) "2014-04-13 00:00:00"
string(19) "2014-04-20 00:00:00"
string(19) "2014-04-27 00:00:00"
string(19) "2014-05-04 00:00:00"
So you can see, that all Mondays is fully ignored! (For BYDAY=SU,TU or SU,WE or any other day of week all works fine.) It is so, because condition
"$imm < $eop" is strict.
When I set "$imm <= $eop" all works fine for ;BYDAY=SU,MO also and Mondays walk into result array of occurrences.

@OzzyCzech
Copy link

Seems fixed:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//SomeExampleStuff//EN
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:Europe/Prague
LAST-MODIFIED:20201011T015911Z
TZURL:http://tzurl.org/zoneinfo-outlook/Europe/Prague
X-LIC-LOCATION:Europe/Prague
BEGIN:DAYLIGHT
TZNAME:CEST
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZNAME:CET
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTART;VALUE=DATE:20140406T000000
RRULE:FREQ=WEEKLY;COUNT=5;INTERVAL=1;BYDAY=SU,MO
DTEND;VALUE=DATE:20140406T010000
SUMMARY:January event
DESCRIPTION:not have
END:VEVENT
END:VCALENDAR

Current version of ical parser generates follow dates

2014-04-06 00:00:00 SU
2014-04-07 00:00:00 MO
2014-04-13 00:00:00 SU
2014-04-14 00:00:00 MO
2014-04-20 00:00:00 SU

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants