timeOfDayIsBetween and Sunrise/Sunset

I am having some trouble with using sunrise and sunset time with isTimeOfDayBetween.

I’ve tried using location.currentValue(“sunriseTime”) as well as getSunriseAndSunset() to get the correct time, but I always seem to get an error when using the returned value with isTimeOfDayBetween(sunset, somearbitrary time, newDate, location.getTimeZone). Any assistance would be appreciated.

    def lightsOnSchedule(){
	//fromTime and toTime are both string values similar to 13:30:00.000 or "Sunrise" or "Sunset"
	def loft = fromTime
    def lott = toTime

	def localSun = getSunriseAndSunset()
    
    log.debug location.currentValue("sunriseTime")
    if(fromTime == "Sunrise"){
    	//Have also tried localSun.sunrise
    	loft = location.currentValue("sunriseTime")
    }
    if(fromTime == "Sunset"){
    	//Have also tried localSun.sunset
    	loft = location.currentValue("sunsetTime")
    }
    if(toTime == "Sunrise"){
    	//Have also tried localSun.sunrise
    	lott = location.currentValue("sunriseTime")
    }
    if(toTime == "Sunset"){
    	//Have also tried localSun.sunset
    	lott = location.currentValue("sunsetTime")
    }
    def now = new Date()
    log.debug "LOFT: $loft, LOTT: $lott, DATE: $now"
	def between = true
    between = timeOfDayIsBetween(loft, lott, new Date(), location.timeZone)
    if(between){
    	log.debug "Within lights on schedule, turn on"
    	lights.on()
    } else {
    	log.debug "Not within lights on schedule. Leaving light off"
    }
	
}

Using location.currentValue(“sunrise”), for example, gives me an error
java.text.ParseException: Unparseable date: “2017-01-13T13:17:00.000Z” @ line 222

Nevermind. Managed to resolve it. Not sure how or what is different but it is working when using locaSun.sunrise now.