Closed kijanawoodard closed 5 years ago
I got the same issue. +1
+1
+1
Does someone have some workaround? If not I will try to spend some time on this.
Thanks
+1
+1
+1 anyone made progress on the issue?
Guess it was related to moment.js setting date to now, when invalid value was entered. should be fixed now (moment.js 2.11.0), so maybe there is a way to fix this issue, too.
I used "moment().toISOString()" for the value as a workaround.
FWIW, as a workaround, I added the following code into angular-daterangepicker in _init()
after creating the daterangepicker:
el.on('apply.daterangepicker', function() {
if(opts.singleDatePicker) {
if($scope.model == null) {
return $scope.$apply(function() {
return $scope.model = moment().startOf('day');
});
}
} else if(angular.isObject($scope.model) && $scope.model.startDate == null && $scope.model.endDate == null) {
return $scope.$apply(function() {
return $scope.model = {
startDate: moment().startOf('day'),
endDate: moment().endOf('day')
};
});
}
});
Curious...why was this issue closed? Was this fixed in 3.0? I couldn't find a merged PR referencing this issue.
The problem we're seeing is that if the user clears the date manually, the control still thinks the previous date is still selected and won't let you select it again.
In the simple case, if the model is set to null, you can't pick "today" because it's already selected in the control.