|
174 | 174 | $scope.monthNumber = Number($filter('date')(new Date($scope.dateMinLimit), 'MM')); |
175 | 175 | $scope.day = Number($filter('date')(new Date($scope.dateMinLimit), 'dd')); |
176 | 176 | $scope.year = Number($filter('date')(new Date($scope.dateMinLimit), 'yyyy')); |
| 177 | + |
| 178 | + setDaysInMonth($scope.monthNumber, $scope.year); |
177 | 179 | } |
178 | 180 | , resetToMaxDate = function resetToMaxDate() { |
179 | 181 |
|
180 | 182 | $scope.month = $filter('date')(new Date($scope.dateMaxLimit), 'MMMM'); |
181 | 183 | $scope.monthNumber = Number($filter('date')(new Date($scope.dateMaxLimit), 'MM')); |
182 | 184 | $scope.day = Number($filter('date')(new Date($scope.dateMaxLimit), 'dd')); |
183 | 185 | $scope.year = Number($filter('date')(new Date($scope.dateMaxLimit), 'yyyy')); |
| 186 | + |
| 187 | + setDaysInMonth($scope.monthNumber, $scope.year); |
184 | 188 | } |
185 | 189 | , prevYear = function prevYear() { |
186 | 190 |
|
|
376 | 380 | setInputValue(); |
377 | 381 | } |
378 | 382 | } |
| 383 | + }) |
| 384 | + , unregisterDateMinLimitWatcher = $scope.$watch('dateMinLimit', function dateMinLimitWatcher(newValue){ |
| 385 | + if(newValue){ |
| 386 | + resetToMinDate(); |
| 387 | + } |
| 388 | + }) |
| 389 | + , unregisterDateMaxLimitWatcher = $scope.$watch('dateMaxLimit', function dateMaxLimitWatcher(newValue){ |
| 390 | + if(newValue){ |
| 391 | + resetToMaxDate(); |
| 392 | + } |
| 393 | + }) |
| 394 | + , unregisterDateFormatWatcher = $scope.$watch('dateFormat', function dateFormatWatcher(newValue){ |
| 395 | + if(newValue){ |
| 396 | + setInputValue(); |
| 397 | + } |
379 | 398 | }); |
380 | 399 |
|
381 | 400 | $scope.nextMonth = function nextMonth() { |
|
486 | 505 | $scope.monthNumber = Number($filter('date')(new Date(selectedMonthNumber + '/01/2000'), 'MM')); |
487 | 506 | setDaysInMonth($scope.monthNumber, $scope.year); |
488 | 507 | setInputValue(); |
489 | | - }; |
| 508 | + }; |
490 | 509 |
|
491 | 510 | $scope.setNewYear = function setNewYear(year) { |
492 | 511 |
|
|
835 | 854 | $scope.$on('$destroy', function unregisterListener() { |
836 | 855 |
|
837 | 856 | unregisterDataSetWatcher(); |
| 857 | + unregisterDateMinLimitWatcher(); |
| 858 | + unregisterDateMaxLimitWatcher(); |
| 859 | + unregisterDateFormatWatcher(); |
838 | 860 | thisInput.off('focus click focusout blur'); |
839 | 861 | angular.element(theCalendar).off('mouseenter mouseleave focusin'); |
840 | 862 | angular.element($window).off('click focus focusin', onClickOnWindow); |
|
0 commit comments