Open EduardsBrown opened 8 years ago
When you enter an invalid hour such as 0 or empty, the DatePicker entry gets reset and defaults to current DateTime.
I believe it should keep the selected DateTime.
angular: 1.5.0 bootstrap-ui-datetime-picker: 1.2.0 bootstrap-sass: 3.3.1
I've also tried on latest versions, and got the same result.
Angular: The issue lives inside timepicker.js
var invalidate = function(invalidHours, invalidMinutes, invalidSeconds) { ngModelCtrl.$setViewValue(null); ngModelCtrl.$setValidity('time', false); if (angular.isDefined(invalidHours)) { $scope.invalidHours = invalidHours; } if (angular.isDefined(invalidMinutes)) { $scope.invalidMinutes = invalidMinutes; } if (angular.isDefined(invalidSeconds)) { $scope.invalidSeconds = invalidSeconds; } };
Specifically: ngModelCtrl.$setViewValue(null);
ngModelCtrl.$setViewValue(null);
Reproduced bug plnkr: https://embed.plnkr.co/SZC1uUaXDcE9CLSb9JiI/
Possible solution plnkr: https://embed.plnkr.co/fj1Ckcg2EcC9ZTaW9Zl1/
(Sometimes when you open the plnkrs, they give Service Unavailable error, please close the plnkr and click on the link again, and it should work).
I am willing to make the change and submit a pull request, if this is fine?
I've tried to fix this by branching off, but after adding the fix the tests didn't pass. I am looking into other ways to fix this issue.
Bug description:
When you enter an invalid hour such as 0 or empty, the DatePicker entry gets reset and defaults to current DateTime.
Selection:
DateTime Resets:
Default Used:
I believe it should keep the selected DateTime.
Version of Angular, UIBS, and Bootstrap
angular: 1.5.0 bootstrap-ui-datetime-picker: 1.2.0 bootstrap-sass: 3.3.1
I've also tried on latest versions, and got the same result.
Angular: The issue lives inside timepicker.js
Specifically:
ngModelCtrl.$setViewValue(null);
Reproduced bug plnkr: https://embed.plnkr.co/SZC1uUaXDcE9CLSb9JiI/
Possible solution plnkr: https://embed.plnkr.co/fj1Ckcg2EcC9ZTaW9Zl1/
(Sometimes when you open the plnkrs, they give Service Unavailable error, please close the plnkr and click on the link again, and it should work).
I am willing to make the change and submit a pull request, if this is fine?