Fixed the date range so that it displays the correct events if the range is set to one day
Change-Id: Ic0d575c332482a49e4d781080fa84e172bcb77dc
Signed-off-by: Iftekharul Islam <iffy.ryan@ibm.com>
diff --git a/app/server-health/controllers/log-controller.js b/app/server-health/controllers/log-controller.js
index 963c6c0..9dab22a 100644
--- a/app/server-health/controllers/log-controller.js
+++ b/app/server-health/controllers/log-controller.js
@@ -18,7 +18,8 @@
'dataService',
'Constants',
'$routeParams',
- function($scope, $window, APIUtils, dataService, Constants, $routeParams){
+ '$filter',
+ function($scope, $window, APIUtils, dataService, Constants, $routeParams, $filter){
$scope.dataService = dataService;
$scope.logs = [];
$scope.tmz = 'EDT';
@@ -97,10 +98,16 @@
}
$scope.filterByDate = function(log){
- if($scope.start_date && $scope.end_date){
- var date = new Date(log.Timestamp);
+ var endDate;
+ if($scope.end_date && typeof $scope.end_date.getTime === 'function'){
+ endDate = new Date($scope.end_date.getTime());
+ endDate.setTime(endDate.getTime() + 86399000);
+ }
+
+ if($scope.start_date && endDate){
+ var date = new Date($filter('date')(log.Timestamp, 'MM/dd/yyyy HH:mm:ss', $scope.tmz));
return (date >= $scope.start_date &&
- date <= $scope.end_date );
+ date <= endDate );
}else{
return true;
}