I have been trying to set the minDate for the datepicker to today, following the example on the angularJS bootstrap site. However, it seems like something is not working correctly. There are no console errors showing up, but it appears that the minDate is not being properly set. Any assistance would be greatly appreciated!
Here's the JavaScript code
angular.module('SelfExam.Quiz', [])
.controller('QuizCtrl',['$scope','MeetingsService', function($scope, MeetingsService) {
// DATEPICKER
// Set default date and make adjustments for weekends
$scope.date = new Date();
$scope.date.setHours(0,0,0,0);
if($scope.date.getDay() == 3 || $scope.date.getDay() == 4) {
$scope.date.setDate($scope.date.getDate() + 5);
} else {
$scope.date.setDate($scope.date.getDate() + 3);
}
// Clear selection function
$scope.clear = function () {
$scope.date = null;
};
// Disable weekend selection
$scope.disabled = function(date, mode) {
return ( mode === 'day' && ( date.getDay() === 0 || date.getDay() === 6 ) );
};
$scope.minDate = new Date();
$scope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$scope.opened = true;
};
$scope.dateOptions = {
formatYear: 'yy',
startingDay: 0
};
$scope.initDate = new Date('2016-15-20');
$scope.formats = ["shortDate"];
$scope.format = $scope.formats[0];
}]);
And here's the corresponding HTML code
...
<div class="col-md-6">
<p class="input-group">
<input type="text" class="form-control" datepicker-popup="shortDate" id="date-field" ng-model="date" is-open="opened" min-date="minDate" max-date="'2015-06-22'" datepicker-options="dateOptions" date-disabled="disabled(date, mode)" ng-required="true" close-text="Close" />
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar" id="cal-button"></i></button>
</span>
</p>
</div>
...