I am trying to adjust a smartapp to be able to ignore triggers within certain times.
currently I am just playing around with the code to get what I want
def startTime = timeToday(starting, location.timeZone)
def endTime = timeToday(ending, location.timeZone)
if (now() < endTime.time && now() > startTime.time) {
log.info "NOW BETWEEN TIMES"
}
else {
log.info "NOW IS OUTSIDE OF TIMES"
}
The issue I have of course, is if the start time is before midnight and the end time is after midnight… since they all basically fall into Today.
How should I adjust the code to add a day to date if the end time falls after midnight and the start time is before midnight?