I have the following code in my controller
:
$scope.a="26-04-2016";
$scope.c = moment($scope.a,"DD-MM-YYYY").format("DD-MM-YYYY");
$scope.b="20-10-2016";
$scope.d = moment($scope.b,"DD-MM-YYYY").format("DD-MM-YYYY");
if($scope.d <= $scope.c){
alert($scope.d+' es menor a '+$scope.c)
}else{
alert($scope.d+' es mayor a '+$scope.c)
}
With this I compare two dates between the 20-10-2016
and the 26-04-2016
, at first glance we know that the 20-10-2016
is greater than the 26-04-2016
but when executing this code it gives me as a result that it is smaller.
What is the problem?