Skip to content
This repository was archived by the owner on Feb 18, 2022. It is now read-only.

Commit ecbaa92

Browse files
committed
Change month when dateMinLimit is set
1 parent 559f1be commit ecbaa92

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/js/angular-datepicker.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@
174174
$scope.monthNumber = Number($filter('date')(new Date($scope.dateMinLimit), 'MM'));
175175
$scope.day = Number($filter('date')(new Date($scope.dateMinLimit), 'dd'));
176176
$scope.year = Number($filter('date')(new Date($scope.dateMinLimit), 'yyyy'));
177+
178+
setDaysInMonth($scope.monthNumber, $scope.year);
177179
}
178180
, resetToMaxDate = function resetToMaxDate() {
179181

@@ -487,6 +489,12 @@
487489
setDaysInMonth($scope.monthNumber, $scope.year);
488490
setInputValue();
489491
};
492+
493+
$scope.$watch('dateMinLimit', function(){
494+
if($scope.dateMinLimit)
495+
resetToMinDate();
496+
})
497+
490498

491499
$scope.setNewYear = function setNewYear(year) {
492500

0 commit comments

Comments
 (0)