jeudi 22 novembre 2018

Compare date with if statement in jQuery to do list

I want to highlight overdue task when refresh page and when click on add task button such as the code below:

$(document).ready(function(){
  $('.add-task').on('click',function(){
    $('.task-date').each(function(){
      var a = new Date().dateFormat('dd/mm/yy').getTime();
      var b = formatDate(b,'dd/mm/yy').getTime();
      var task = new Date($('.task-date')).getTime();
      if(task < b) {
        return $('todo-task').addClass('overdue');
      }
    });
  });
});

I tried some other ways but still not working so please check JSFiddle here and source site here and help me. Thank you.

Aucun commentaire:

Enregistrer un commentaire