datepicker: validation issues
The following example demonstrates two issues I have found with the datepicker. The example has two datepicker fields, date1 and date2. The min date fot date2 is date1. http://codepen.io/anon/pen/ZbdXgK
-
After the first load, date2 is set 2 days after date1. The min date for date2 should be date1 inclusively, but only the next day is selectable from the dropdown. If I select the current date for date1 in the dropdown, then the current date gets selectable for date2 as well.
-
Setting date1 to a date that is after date2 does not invalidate date2 regardless it is set before the min date.
Same problem
+1
Possibly a timezone issue.
The second issue noted by @matyee simply requires a $watch on mdMinDate in DatePickerCtrl to run the validation logic when it's changed.
Here's the obvious quick workaround that resets the second date when the first changes, which forces the datepicker to validate:
$scope.$watch('startDate', function () {
var end = $scope.endDate;
$scope.endDate = null;
$timeout(function () {
$scope.endDate = end;
});
});
Demo: http://codepen.io/anon/pen/xVPopG
This issue is closed as part of our deprecation effort. For details, see our post Spring Cleaning 2016.