fix a glitch at monthly repetition on the same day

This commit is contained in:
Tibor Kaputa 2017-05-09 14:29:53 +02:00
parent 0706f15ea0
commit bf6f666d63
1 changed files with 4 additions and 0 deletions

View File

@ -49,6 +49,10 @@ data class Event(var id: Int = 0, var startTS: Int = 0, var endTS: Int = 0, var
// if an event should happen on 31st with Same Day monthly repetition, dont show it at all at months with 30 or less days
private fun addMonthsWithSameDay(currStart: DateTime, original: Event): DateTime {
var newDateTime = currStart.plusMonths(repeatInterval / MONTH)
if (newDateTime.dayOfMonth == currStart.dayOfMonth) {
return newDateTime
}
while (newDateTime.dayOfMonth().maximumValue < Formatter.getDateTimeFromTS(original.startTS).dayOfMonth().maximumValue) {
newDateTime = newDateTime.plusMonths(repeatInterval / MONTH)
newDateTime = newDateTime.withDayOfMonth(newDateTime.dayOfMonth().maximumValue)