I need one help.I need to compare todays date with future date using Angular.js . I am explaining my code below.
$scope.getFutureDate = function() {
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth() + 1; //January is 0!
var yyyy = today.getFullYear();
if (dd < 10) {
dd = '0' + dd
}
if (mm < 10) {
mm = '0' + mm
}
var today = dd + '-' + mm + '-' + yyyy;
return today;
}
$scope.addPlanData = function() {
var today = $scope.getFutureDate();
if (today < $scope.date) {
alert('Please select todays date or previous date');
}
}
Here my requirement is when todays date will less than future date it will show me the alert message.In this code its happening only within the month.But if i will compare with like this 30-11-2015 with 1-12-2015
,its not showing any alert message.Please help me.