I am trying to compare 2 dates and to filter my data with the result:
my controller:
$scope.checkDate = function(startDate){
var todaysDate = new Date();
return function(coupon){
return coupon[startDate]<= todaysDate;
};
}
my html:
<div class="col-sm-3" id="coupon-tiles" ng-repeat="coupon in allCoupons| filter: checkDate('startDate')" ng-if="coupon.amount>0" >
<div>
<image ng-src={{coupon.image}}>
</div>
<div>{{coupon.title}}</div>
<div>price:{{coupon.price}}</div>
<div>start date:{{coupon.startDate}}</div>
<div>end date:{{coupon.endDate}}</div>
<div class="btn-group" role="group" aria-label="...">
<button type="button" class="btn btn-default" ng- click="buy(coupon)">Purchase</button>
</div>
</div>
The coupons arrive from the db through json, the dates are java sql dates so the format is yyyy,mm,dd , Jersey and Jackson doing the parsing.
Nothing seems to work, can someone help