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

Commit fe0e725

Browse files
committed
Added watcher to date-max-limit and date-format
1 parent 869afed commit fe0e725

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/js/angular-datepicker.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@
183183
$scope.monthNumber = Number($filter('date')(new Date($scope.dateMaxLimit), 'MM'));
184184
$scope.day = Number($filter('date')(new Date($scope.dateMaxLimit), 'dd'));
185185
$scope.year = Number($filter('date')(new Date($scope.dateMaxLimit), 'yyyy'));
186+
187+
setDaysInMonth($scope.monthNumber, $scope.year);
186188
}
187189
, prevYear = function prevYear() {
188190

@@ -383,6 +385,14 @@
383385
if(newValue){
384386
resetToMinDate();
385387
}
388+
})
389+
, unregisterDateMaxLimitWatcher = $scope.$watch('dateMaxLimit', function dateMaxLimitWatcher(newValue){
390+
if(newValue)
391+
resetToMaxDate();
392+
})
393+
, unregisterDateFormatWatcher = $scope.$watch('dateFormat', function dateFormatWatcher(newValue){
394+
if(newValue)
395+
setInputValue();
386396
});
387397

388398
$scope.nextMonth = function nextMonth() {
@@ -839,6 +849,8 @@
839849

840850
unregisterDataSetWatcher();
841851
unregisterDateMinLimitWatcher();
852+
unregisterDateMaxLimitWatcher();
853+
unregisterDateFormatWatcher();
842854
thisInput.off('focus click focusout blur');
843855
angular.element(theCalendar).off('mouseenter mouseleave focusin');
844856
angular.element($window).off('click focus focusin', onClickOnWindow);

0 commit comments

Comments
 (0)