--- libical/src/libical/icalrecur.c 3 Feb 2008 16:10:46 -0000 1.71
+++ libical/src/libical/icalrecur.c 7 Apr 2008 23:02:12 -0000
@@ -944,19 +944,24 @@ icalrecur_iterator* icalrecur_iterator_n
       days ahead ) will skip over some occurrences in the
       second week. */

    /* This depends on impl->by_ptrs[BY_DAY] being correctly sorted by
     * day. This should probably be abstracted to make such assumption
     * more explicit. */
    short dow = (short)(impl->by_ptrs[BY_DAY][0]-icaltime_day_of_week(impl->last));

-   if (dow > impl->rule.week_start-1) dow -= 7;
-   impl->last.day += dow;
-   impl->last = icaltime_normalize(impl->last);
+
+    if((icaltime_day_of_week(impl->last) < impl->by_ptrs[BY_DAY][0] && dow >= 0) || dow < 0)
+    {
+      /* initial time is after first day of BY_DAY data */
+
+      impl->last.day += dow;
+      impl->last = icaltime_normalize(impl->last);
+    }
       }


     }

     /* For YEARLY rule, begin by setting up the year days array . The
        YEARLY rules work by expanding one year at a time. */
