Skip to content

fix: import weekday-only recurring events (FREQ=DAILY;BYDAY)#1239

Open
MiMoHo wants to merge 1 commit into
FossifyOrg:mainfrom
MiMoHo:fix/issue-232
Open

fix: import weekday-only recurring events (FREQ=DAILY;BYDAY)#1239
MiMoHo wants to merge 1 commit into
FossifyOrg:mainfrom
MiMoHo:fix/issue-232

Conversation

@MiMoHo

@MiMoHo MiMoHo commented Jul 3, 2026

Copy link
Copy Markdown

Type of change(s)

  • Bug fix

What changed and why

Recurring events exported as RRULE:FREQ=DAILY;BYDAY=MO,TU,WE,TH,FR without an INTERVAL field (the format Thunderbird / DAVx5 use for "repeat every weekday") were imported as plain every-day events and therefore also appeared on Saturdays and Sundays (issue #232).

In Parser.parseRepeatInterval(), the FREQ=DAILY branch that converts a weekday-restricted daily rule into a weekly repetition was gated on the RRULE containing INTERVAL:

} else if (value == DAILY && fullString.contains(INTERVAL)) {

When only BYDAY (and no INTERVAL) is present, this branch is skipped, so repeatInterval stays DAY (86400). The later BYDAY handler is then a no-op because repeatInterval.isXWeeklyRepetition() is false for a daily interval, so no weekday bitmask is ever applied and the event repeats every day.

The fix enters the branch when either INTERVAL or BYDAY is present, and additionally guards the "interval is a multiple of 7" check with an INTERVAL presence test (so BYDAY-only rules fall through to the BYDAY conversion and never call interval.toInt() on a non-numeric value):

} else if (value == DAILY && (fullString.contains(INTERVAL) || fullString.contains("BYDAY"))) {
    val interval = fullString.substringAfter("$INTERVAL=").substringBefore(";")
    if (fullString.contains(INTERVAL) && interval.areDigitsOnly() && interval.toInt() % 7 == 0) {
        ...
    } else if (fullString.contains("BYDAY")) {
        repeatInterval = WEEK_SECONDS
    }
}

This sets repeatInterval = WEEK_SECONDS (604800), so the existing BYDAY handler produces the correct Mon-Fri bitmask, making FREQ=DAILY;BYDAY=... behave identically to FREQ=WEEKLY;BYDAY=.... All previously handled cases (plain FREQ=DAILY, FREQ=DAILY;INTERVAL=n, FREQ=DAILY;INTERVAL=14, FREQ=DAILY;INTERVAL=1;BYDAY=...) keep their prior behavior.

Tests performed

Built the fossDebug variant and verified on an Android 15 (API 35) emulator:

Imported ICS with RRULE:FREQ=DAILY;BYDAY=MO,TU,WE,TH,FR (DTSTART Mon 2026-07-06). Month view shows 'Weekday standup' on every weekday (Mon-Fri) and absent on all weekends. Event detail shows repetition = Weekly, Repeat on Mon,Tue,Wed,Thu,Fri (not plain Daily).

Also confirmed detekt, lint, unit tests and the build all pass locally (CI-equivalent).

Closes the following issue(s)

Checklist

  • I read the contribution guidelines.
  • I manually tested my changes on device/emulator.
  • I updated the "Unreleased" section in CHANGELOG.md (if applicable).
  • I have self-reviewed my pull request (no typos, formatting errors, etc.).
  • I understand every change in this pull request.

Coded with Opus 4.8 ultracode.

Recurrences exported as RRULE:FREQ=DAILY;BYDAY=MO,TU,WE,TH,FR without an
INTERVAL field (e.g. from Thunderbird/DAVx5) were imported as plain
every-day events, showing on weekends too.

The DAILY branch in parseRepeatInterval() was gated on the RRULE
containing INTERVAL, so weekday-only daily rules skipped the conversion
to weekly repetition and repeatInterval stayed DAY, making the later
BYDAY handling a no-op. Enter the branch when either INTERVAL or BYDAY is
present, and guard the interval-multiple check with an INTERVAL presence
test so BYDAY-only rules convert to weekly repetition and produce the
correct Mon-Fri bitmask, matching FREQ=WEEKLY;BYDAY handling.
@MiMoHo MiMoHo requested a review from naveensingh as a code owner July 3, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"repeat every weekday" events from Thunderbird show every day in Fossify

1 participant