I want to hide a checkbox on a certain date for example 17 Nov using AngularJS and MomentJS. I used a function
$scope.today = moment('2017-11-17').toDate();
$scope.checkNov = function(value) {
if (moment().diff(value, 'day') == 0 && moment().diff(value, 'month') == 0 && moment().diff(value, 'year') == 0) return true;
}
and called it on div for checkbox
<div ng-hide="checkNov(today)">
<input type="checkbox"></div>
the function is returning value=true
that will give ng-hide="true"
then it should hide. But it is still visible.
Also how to check for exact date comparision using Moment.JS? Because when I checked using console.log
it is working for 18 nov as well.
Thank you.
You could try this for the exact date comparison http://momentjs.com/docs/#/query/is-same/