I think a better fix is to maketodayvariable rather than a const and usetoday.setHours(0),today.setMinutes(0), andtoday.setSeconds(0)to force the time field to match the timefield in all the term start and end dates. This means that you'll always be comparing just dates....