diff --git a/date_repeat/date_repeat_calc.inc b/date_repeat/date_repeat_calc.inc index 2a02d94..d6ceb3f 100644 --- a/date_repeat/date_repeat_calc.inc +++ b/date_repeat/date_repeat_calc.inc @@ -238,6 +238,9 @@ function _date_repeat_calc($rrule, $start, $end, $exceptions, $timezone, $additi } } ksort($week_days); + // This is needed if weekly interval > 1. Otherwise if start date is the + // first of the days selected, the weeks are not selected correctly. + $day = reset($rrule['BYDAY']); // BYDAYs with parameters like -1SU (last Sun) or 2TH (second Thur) // need to be processed one month or year at a time. @@ -578,4 +581,4 @@ function date_repeat_set_year_day($date_in, $day, $count = 1, $direction = '+', } } return $date_in; -} \ No newline at end of file +}