Is there a "calendar" component/counterpart to the...
# kotlinx-datetime
t
Is there a "calendar" component/counterpart to the kotlinx-datetime effort for doing things like "i want the nearest coming hour for a given instant in the context of a given timezone (e.g. 13.32 -> 14.00)?
I came up with
Copy code
fun 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