update the end time if start time is after the end, close #115

This commit is contained in:
tibbi 2017-02-19 23:48:11 +01:00
parent 681dc87b67
commit 0f7b950e15

View file

@ -364,6 +364,11 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
if (isStart) {
mEventStartDateTime = mEventStartDateTime.withDate(year, month + 1, day)
updateStartDate()
if (mEventStartDateTime.isAfter(mEventEndDateTime)) {
mEventEndDateTime = mEventStartDateTime
updateEndDate()
updateEndTime()
}
} else {
mEventEndDateTime = mEventEndDateTime.withDate(year, month + 1, day)
updateEndDate()
@ -375,6 +380,10 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
if (isStart) {
mEventStartDateTime = mEventStartDateTime.withHourOfDay(hours).withMinuteOfHour(minutes)
updateStartTime()
if (mEventStartDateTime.isAfter(mEventEndDateTime)) {
mEventEndDateTime = mEventStartDateTime
updateEndTime()
}
} else {
mEventEndDateTime = mEventEndDateTime.withHourOfDay(hours).withMinuteOfHour(minutes)
updateEndTime()