I'm trying to use the "time" input type and parse the value into a java.time.LocalDateTime whilst correctly handling time zone offsets. I've come up with the function below but I would really appreciate any feedback if there's an easier/more appropriate way to do this in Hubitat.
def toLocalDateTime(inputDateTime) {
def inputTime=inputDateTime.substring(inputDateTime.indexOf("T"))
int offsetIndex=Math.max(inputTime.indexOf("+"), inputTime.indexOf("-"))
ZoneId zone = offsetIndex > -1
? ZoneId.of(inputTime.substring(offsetIndex))
: ZoneId.systemDefault()
toDateTime(inputDateTime).toInstant().atZone(zone).toLocalDateTime()
}