Travis Griggs
08/16/2023, 8:21 PMTravis Griggs
08/16/2023, 10:43 PMfun TimeZone.comingHour(instant: Instant): Instant {
val ldt = instant.toLocalDateTime(this)
val time = ldt.time
val atHour = LocalTime(hour = time.hour, minute = 0)
if (atHour == time) {
return instant
}
val (d, t) = when (atHour.hour) {
23 -> ldt.date + DatePeriod(days = 1) to LocalTime(0, 0)
else -> ldt.date to LocalTime(hour = atHour.hour + 1, minute = 0)
}
return t.atDate(d).toInstant(this)
}
as a first quick and dirty. But it seems there should be a more succint way to do this