I am using the Datepicket that is part of the AngularJS ui-bootstrap module. I'm following the tutorial / example given (see http://angular-ui.github.io/bootstrap/#/datepicker) but when trying to prevent users from selecting dates earlier than today or greater than 3 months from today doesn't seem to be working correctly as these are still clickable.
This is the datepicker in my view... I've written the ng-model, min-date & max-date values to the interface to make sure these are not null)
<datepicker ng-model="dt" min-date="minDate" max-date="maxDate" show-weeks="false"></datepicker>
dt = {{ dt }}
minDate = {{ minDate }}
maxDate = {{ maxDate }}
The values are being returned....
dt = "2014-04-30T15:31:46.746Z"
minDate = "2014-05-27T15:31:46.746Z"
maxDate = "2014-08-27T15:31:46.751Z"
this is my controller code... most of it taken from the example provided on the ui-bootstrap site
$scope.today = function() {
$scope.dt = new Date();
};
$scope.today();
$scope.toggleMin = function() {
$scope.minDate = $scope.minDate ? null : new Date();
};
$scope.toggleMin();
$scope.maxDate = new Date(new Date().setMonth(new Date().getMonth()+3));
Can anyone see what I'm doing wrong? I can't see what typo or mistake I have made? I am using Chrome 34.0.1847.137 on OS X 10.9.2 so browser compatibility shouldn't be an issue.