JavaScript uses objects to store date values. When you want to compare if two dates are equal don't do this like date1 === date2
. That will just tell you if the two variables reference the same object.
To check if two dates are equal use the getTime() method of the date object. Like this:
date1.getTime() == date2.getTime()
Be careful because any difference in seconds will fail to match the dates.
Now ng-if
will accept AngularJS expressions.
Ensure that both variables are valid JavaScript date objects.
I recommend that you use the moment javascript library for date processing. It makes working with dates a lot easier.