1var checkTime = function () {
2 var hour = $(".hour").text().trim();
3
4 var time = moment(hour, "LT");
5 console.log(time)
6
7 //remove any old classes from element
8 $(".hour").removeClass(".present .past .future");
9
10 // apply new class if task is near/over due date
11 if (moment().isAfter(time)) {
12 $(".hour").addClass(".past");
13 } else if (moment().isBefore(time)) {
14 $(".hour").addClass(".future");
15 } else {
16 $(".hour").addClass(".present");
17 }
18}
19
20checkTime();