I added an event to our Calendar node (uses the date api) that runs from January thru April. Everything displays OK except the first week of Feb, March and April. The events are not displayed in the calendar.
Upon debugging, I found my way into _date_repeat_calc() in date/date_repeat/date_repeat_calc.inc which is I think responsible for determining which days match the requested rule.
RRULE:
FREQ=DAILY;INTERVAL=1;BYDAY=SU,MO,TU,WE,TH,FR,SA;UNTIL=20100418T160000Z;WKST=SU
Returned $days by _date_repeat_calc():
[9] => 2010-01-28 00:00:00
[10] => 2010-01-29 00:00:00
[11] => 2010-01-30 00:00:00
[12] => 2010-01-31 00:00:00
... NO DATE from Feb 1 - Feb 6 ...
[13] => 2010-02-07 00:00:00
[14] => 2010-02-08 00:00:00
[15] => 2010-02-09 00:00:00
[33] => 2010-02-27 00:00:00
[34] => 2010-02-28 00:00:00
... AGAIN, MISSING DATES HERE...
[35] => 2010-03-07 00:00:00
[36] => 2010-03-08 00:00:00
[58] => 2010-03-30 00:00:00
[59] => 2010-03-31 00:00:00
... AND AGAIN ...
[60] => 2010-04-04 00:00:00
[61] => 2010-04-05 00:00:00
Using the dev version, I found this line that excludes those dates (line 291-293, date/date_repeat/date_repeat_calc.inc)
if ($rrule['FREQ'] == 'WEEKLY' || date_format($current_day, $format) == $current_period) {
date_repeat_add_dates($days, $current_day, $start_date, $end_date, $exceptions, $rrule);
}
The last week of January starts at 31 so that period looks like this
01-31 - Sunday
02-01 - Monday
02-02 - Tuesday
02-03 - Wednesday
02-04 - Thursday
02-05 - Friday
02-06 - Saturday
The line 291 above checks if the current day's month is the same of the current period's month which will return false. Disabling this condition resolves my problem of missing dates.
The question is, what was the reason behind line 291? Disabling this might resolve my problem but could cause another problem in other rrule so I want to understand.
Comments
Comment #1
MBroberg commentedI'm so glad you posted - I was going crazy with this issue trying to figure out the pattern!
I have an event that repeats on Sat and Sun for 2 weeks and the 2nd Sat was missing.
It also took away the 1st Friday of the month when I edited it, so I can confirm that this is a problem.
Once I changed to "every week" instead of "every day" the date appeared correctly.
Comment #2
MBroberg commentedAppears to be a duplicate of this issue, or at least part of it...
http://drupal.org/node/369020
Comment #3
damienmckennaUnfortunately the Drupal 6 version of the Date module is no longer supported. That said, we appreciate that you took time to work on this issue. Should this request still be relevant for Drupal 7 please feel free to reopen it. Thank you.