Skip to content

Commit

Permalink
Changed xpath for time element
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalii Fedorenko committed Jan 9, 2016
1 parent 2c7d772 commit 4f22d28
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions datetimepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,9 @@ angular.module('ui.bootstrap.datetimepicker',
scope.$watch(function() {
return scope.ngModel;
}, function(newTime) {
var timeElement = document.evaluate("//uib-timepicker",
var timeElement = document.evaluate("//*[@ng-model='time']",
element[0], null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue

// if a time element is focused, updating its model will cause hours/minutes to be formatted by padding with leading zeros
if (timeElement && !timeElement.contains(document.activeElement)) {
if (newTime === null || newTime === '') { // if the newTime is not defined
Expand All @@ -177,7 +178,6 @@ angular.module('ui.bootstrap.datetimepicker',
return;
}
}

// Update timepicker (watch on ng-model in timepicker does not use object equality),
// also if the ngModel was not a Date, convert it to date
newTime = new Date(newTime);
Expand Down Expand Up @@ -247,3 +247,6 @@ angular.module('ui.bootstrap.datetimepicker',
}
};
}]);



0 comments on commit 4f22d28

Please sign in to comment.