Can someone tell me why my date is not working. Basically, when I try to compare the date, then it does not work in angularJs
var dateObj1 = $filter("date")(Date.now(), 'dd-MMM-yyyy'); // output is "04-May-2016" var dateObj2 = $scope.employee.Tue; // output is "03-May-2016" if (dateObj1 < dateObj2) { return true } else { return false; }
above works, but for the case below does not work, if I use the date as "26-Apr-2016", I will return
var dateObj1 = $filter("date")(Date.now(), 'dd-MMM-yyyy'); // output is "04-May-2016" var dateObj2 = $scope.employee.Tue; // output is "26-Apr-2016" if (dateObj1 < dateObj2) { return true } else { return false; }
source share