You have to remember that, if the endHour < startHour, it's actually on a different day, ie. 24 hours later than it says. Likewise, for an hour to be in this range, it could be on either day, so if it's < startHour, it could be on the next day.
if currentHour < startHour:
currentHour += 24
if endHour < startHour:
endHour += 24
if currentHour >= startHour and currentHour <= endHour:
//...code