Skip to content

Commit

Permalink
Prevent undefined from and to timepicker dates. (elastic#20355)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjcenizal committed Jun 29, 2018
1 parent 12566ef commit 0a5bccd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ui/public/timepicker/timepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,18 @@ module.directive('kbnTimepicker', function (refreshIntervals) {
// If we always return a new object from the getters below (pickFromDate and pickToDate) we'll create an
// infinite digest loop, so we maintain these copies to return instead.
$scope.$watch('absolute.from', function (newDate) {
if (!newDate) {
return;
}

_.set($scope, 'browserAbsolute.from', new Date(newDate.year(), newDate.month(), newDate.date()));
});

$scope.$watch('absolute.to', function (newDate) {
if (!newDate) {
return;
}

_.set($scope, 'browserAbsolute.to', new Date(newDate.year(), newDate.month(), newDate.date()));
});

Expand Down

0 comments on commit 0a5bccd

Please sign in to comment.