mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-17 12:20:51 +01:00
properly fetch the current hour of the day, even with changed time zone
This commit is contained in:
parent
199399bf29
commit
ac37c1998c
@ -37,8 +37,6 @@ import com.simplemobiletools.calendar.pro.receivers.NotificationReceiver
|
||||
import com.simplemobiletools.calendar.pro.services.SnoozeService
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.*
|
||||
import org.joda.time.DateTime
|
||||
import org.joda.time.DateTimeZone
|
||||
import org.joda.time.LocalDate
|
||||
import java.util.*
|
||||
|
||||
@ -342,8 +340,9 @@ fun Context.launchNewEventIntent(dayCode: String = Formatter.getTodayCode()) {
|
||||
}
|
||||
|
||||
fun Context.getNewEventTimestampFromCode(dayCode: String): Long {
|
||||
val calendar = Calendar.getInstance()
|
||||
val defaultStartTime = config.defaultStartTime
|
||||
val currHour = DateTime(System.currentTimeMillis(), DateTimeZone.getDefault()).hourOfDay
|
||||
val currHour = calendar.get(Calendar.HOUR_OF_DAY)
|
||||
var dateTime = Formatter.getLocalDateTimeFromCode(dayCode).withHourOfDay(currHour)
|
||||
var newDateTime = dateTime.plusHours(1).withMinuteOfHour(0).withSecondOfMinute(0).withMillisOfSecond(0)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user