Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c820145e authored by Andy McFadden's avatar Andy McFadden
Browse files

Reduce definition of monthly rep test

The repeatsMonthlyOnDayCount() function was returning true for events
like FREQ=MONTHLY;BYDAY=TU which actually appear weekly.  This is not
the desired behavior of the function.

Bug 4522027

Change-Id: I03ef68b429828097c8bad7fcd374e7c9eb4c7b03
parent 808be0d0
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -456,6 +456,19 @@ public class EventRecurrence {
        return true;
    }

    /**
     * Determines whether this rule specifies a simple monthly rule by weekday, such as
     * "FREQ=MONTHLY;BYDAY=3TU" (the 3rd Tuesday of every month).
     * <p>
     * Negative days, e.g. "FREQ=MONTHLY;BYDAY=-1TU" (the last Tuesday of every month),
     * will cause "false" to be returned.
     * <p>
     * Rules that fire every week, such as "FREQ=MONTHLY;BYDAY=TU" (every Tuesday of every
     * month) will cause "false" to be returned.  (Note these are usually expressed as
     * WEEKLY rules, and hence are uncommon.)
     *
     * @return true if this rule is of the appropriate form
     */
    public boolean repeatsMonthlyOnDayCount() {
        if (this.freq != MONTHLY) {
            return false;
@@ -465,6 +478,10 @@ public class EventRecurrence {
            return false;
        }

        if (bydayNum[0] <= 0) {
            return false;
        }

        return true;
    }