From 109f3a3f3e1dcc1a503bf629bbebd252507230ad Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 8 May 2017 19:10:56 +0200 Subject: [PATCH] properly show events repeating monthly the last day of the month --- .../kotlin/com/simplemobiletools/calendar/models/Event.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 368c30cbd..221ccd153 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/models/Event.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/models/Event.kt @@ -25,7 +25,11 @@ data class Event(var id: Int = 0, var startTS: Int = 0, var endTS: Int = 0, var if (repeatInterval % YEAR == 0) { currStart.plusYears(repeatInterval / YEAR) } else if (repeatInterval % MONTH == 0) { - currStart.plusMonths(repeatInterval / MONTH) + if (repeatRule == REPEAT_MONTH_LAST_DAY) { + currStart.plusMonths(repeatInterval / MONTH).dayOfMonth().withMaximumValue() + } else { + currStart.plusMonths(repeatInterval / MONTH) + } } else if (repeatInterval % WEEK == 0) { // step through weekly repetition by days too, as events can trigger multiple times a week currStart.plusDays(1)