AngularJs ng-if comparing dates AngularJs ng-if comparing dates angularjs angularjs

AngularJs ng-if comparing dates


If they're date object just compare them directly without .getTime()

$scope.date2005 = new Date('2005/01/01');$scope.date2006 = new Date('2006-01-01T04:00:00.000Z');
<div ng-if="date2005 > date2006">date2005 > date2006</div> <!-- won't show --><div ng-if="date2006 > date2005">date2006 > date2005</div> <!-- will show -->

http://plnkr.co/edit/fNB11U6KmFszdV3lMAPJ?p=preview


Angular can directly compare date if they are well formated:

view

li.list-group-item(ng-if="app.Segments[0].StartDate > now")

controller

$scope.now = new Date();$scope.now.toISOString();