From c361d3838c82ce38b603b5890bc9549427a4fdcd Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Tue, 25 Feb 2014 13:16:44 -0700 Subject: [PATCH] Fix date moving backwards east of the prime meridian. Closes #709 --- src/app/panels/goal/module.js | 1 - src/app/panels/timepicker/module.js | 10 +++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/app/panels/goal/module.js b/src/app/panels/goal/module.js index 2229f86ceec20..5f25ecb46b7f2 100644 --- a/src/app/panels/goal/module.js +++ b/src/app/panels/goal/module.js @@ -143,7 +143,6 @@ define([ { label : 'Complete', data : complete, color: querySrv.colors[parseInt($scope.$id, 16)%8] }, { data : remaining, color: Chromath.lighten(querySrv.colors[parseInt($scope.$id, 16)%8],0.70).toString() } ]; - console.log(parseInt($scope.$id, 16)%8); $scope.$emit('render'); }); }; diff --git a/src/app/panels/timepicker/module.js b/src/app/panels/timepicker/module.js index 7e120da5afe2b..929877445f64a 100644 --- a/src/app/panels/timepicker/module.js +++ b/src/app/panels/timepicker/module.js @@ -77,10 +77,18 @@ function (angular, app, _, moment, kbn) { $scope.input.$setValidity("dummy", true); $scope.temptime = cloneTime($scope.time); - // Date picker needs the date to be at the start of the day + //Date picker needs the date to be at the start of the day $scope.temptime.from.date.setHours(0,0,0,0); $scope.temptime.to.date.setHours(0,0,0,0); + console.log(new Date().getTimezoneOffset()); + + // This is an ugly hack, but works. + if(new Date().getTimezoneOffset() < 0) { + $scope.temptime.from.date = moment($scope.temptime.from.date).add('days',1).toDate(); + $scope.temptime.to.date = moment($scope.temptime.to.date).add('days',1).toDate(); + } + $q.when(customTimeModal).then(function(modalEl) { modalEl.modal('show'); });