Anonymous - 2011-10-05

I found the cause of this bug. In functions.php, function get_all_dates, you have the following code which is executed for monthly or monthly by date events:

// Skip to this year if called from query_events and we don't need count.
if ( ! empty ( $jump ) && $Count == 999 ) {
while ( $cdate < $jump ) {
$thismonth += $interval;
$cdate = mktime ( $hour, $minute, 0, $thismonth, $thisday, $thisyear );
}
}

This is an optimization to avoid including a bunch of past instances that the user won't be interested in. It works fine for events that are strictly monthly. But for "monthly by date" events, it's a problem. Suppose that my event occurred on Sept. 1 on the year in which I loaded it, but on Sept. 4 this year, and that my cutoff date is Sept. 3. The routine will advance me to this year's Sept. 1, determine that it's still before the cutoff, and advance all the way to Oct. 1, causing the Sept. 4 instance to be missed.

It seemed to fix it when I changed the while condition to this:

while ( $cdate + 604800 < $jump ) {

so that it starts looking for instances up to a week before the anniversary of the original event.