Untitled
unknown
javascript
2 years ago
1.2 kB
8
Indexable
$scope.alterRange = function(){
if (!$filter('isEmpty')($scope.dateRange.startDate)) {
$scope.validDates.minEndDate = moment($scope.dateRange.startDate).startOf('day').toDate();
if(moment($scope.dateRange.startDate).add(1, 'year').startOf('day').toDate() > $rootScope.currentDate) {
$scope.validDates.maxEndDate = $rootScope.currentDate;
}
else {
$scope.validDates.maxEndDate = moment($scope.dateRange.startDate).add(1, 'year').startOf('day').toDate();
}
}
};
var refreshValidDates = function() {
$scope.validDates.minDate = moment($rootScope.currentDate).subtract(5, 'years').startOf('day').toDate(),
$scope.validDates.maxDate = moment($rootScope.currentDate).startOf('day').toDate(),
$scope.validDates.minEndDate = moment($rootScope.currentDate).subtract(5, 'years').startOf('day').toDate(),
$scope.validDates.maxEndDate = moment($rootScope.currentDate).startOf('day').toDate();
$scope.alterRange();
};
refreshValidDates();Editor is loading...