diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt index 09b086017..66cd349cd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt @@ -424,8 +424,7 @@ class EventActivity : SimpleActivity() { private fun getYearlyRepetitionRuleText() = when (mRepeatRule) { REPEAT_SAME_DAY -> getString(R.string.the_same_day) - REPEAT_ORDER_WEEKDAY -> getRepeatXthDayInMonthString(false, mRepeatRule) - else -> "" + else -> getRepeatXthDayInMonthString(false, mRepeatRule) } private fun showEventTypeDialog() { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/models/Event.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/models/Event.kt index bb6ea65a7..29cda236b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/models/Event.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/models/Event.kt @@ -29,11 +29,15 @@ data class Event(var id: Int = 0, var startTS: Int = 0, var endTS: Int = 0, var else -> { val currStart = Formatter.getDateTimeFromTS(startTS) val newStart = when { - repeatInterval % YEAR == 0 -> currStart.plusYears(repeatInterval / YEAR) + repeatInterval % YEAR == 0 -> when (repeatRule) { + REPEAT_ORDER_WEEKDAY -> addXthDayInterval(currStart, original, false) + REPEAT_ORDER_WEEKDAY_USE_LAST -> addXthDayInterval(currStart, original, true) + else -> currStart.plusYears(repeatInterval / YEAR) + } repeatInterval % MONTH == 0 -> when (repeatRule) { REPEAT_SAME_DAY -> addMonthsWithSameDay(currStart, original) - REPEAT_ORDER_WEEKDAY_USE_LAST -> addXthDayInterval(currStart, original, true) REPEAT_ORDER_WEEKDAY -> addXthDayInterval(currStart, original, false) + REPEAT_ORDER_WEEKDAY_USE_LAST -> addXthDayInterval(currStart, original, true) else -> currStart.plusMonths(repeatInterval / MONTH).dayOfMonth().withMaximumValue() } repeatInterval % WEEK == 0 -> {