mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
fixing an illegal offset exception caused by daylight savings
This commit is contained in:
@@ -1100,17 +1100,22 @@ class EventActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun timeSet(hours: Int, minutes: Int, isStart: Boolean) {
|
private fun timeSet(hours: Int, minutes: Int, isStart: Boolean) {
|
||||||
if (isStart) {
|
try {
|
||||||
val diff = mEventEndDateTime.seconds() - mEventStartDateTime.seconds()
|
if (isStart) {
|
||||||
|
val diff = mEventEndDateTime.seconds() - mEventStartDateTime.seconds()
|
||||||
|
|
||||||
mEventStartDateTime = mEventStartDateTime.withHourOfDay(hours).withMinuteOfHour(minutes)
|
mEventStartDateTime = mEventStartDateTime.withHourOfDay(hours).withMinuteOfHour(minutes)
|
||||||
updateStartTimeText()
|
updateStartTimeText()
|
||||||
|
|
||||||
mEventEndDateTime = mEventStartDateTime.plusSeconds(diff.toInt())
|
mEventEndDateTime = mEventStartDateTime.plusSeconds(diff.toInt())
|
||||||
updateEndTexts()
|
updateEndTexts()
|
||||||
} else {
|
} else {
|
||||||
mEventEndDateTime = mEventEndDateTime.withHourOfDay(hours).withMinuteOfHour(minutes)
|
mEventEndDateTime = mEventEndDateTime.withHourOfDay(hours).withMinuteOfHour(minutes)
|
||||||
updateEndTimeText()
|
updateEndTimeText()
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
timeSet(hours + 1, minutes, isStart)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user