diff options
Diffstat (limited to 'www')
| -rw-r--r-- | www/js/EventCtrl.js | 7 | ||||
| -rw-r--r-- | www/js/MontageCtrl.js | 35 | ||||
| -rw-r--r-- | www/templates/montage.html | 6 |
3 files changed, 39 insertions, 9 deletions
diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js index dfdbb779..f5719226 100644 --- a/www/js/EventCtrl.js +++ b/www/js/EventCtrl.js @@ -676,9 +676,10 @@ angular.module('zmApp.controllers') disableBack: true }); - var mToDate = moment(); - - var mFromDate = moment().subtract(parseInt(val), unit); + + // we have to convert from and to, to server time + var mToDate = moment().tz(NVRDataModel.getTimeZoneNow()); + var mFromDate = moment().subtract(parseInt(val), unit).tz(NVRDataModel.getTimeZoneNow()); // console.log("Moment Dates:" + mFromDate.format() + " TO " + mToDate.format()); diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js index 88487231..a012c0e7 100644 --- a/www/js/MontageCtrl.js +++ b/www/js/MontageCtrl.js @@ -389,7 +389,12 @@ angular.module('zmApp.controllers') $rootScope.rand = Math.floor((Math.random() * 100000) + 1); // if you see the time move, montage should move - $scope.timeNow = moment().format(NVRDataModel.getTimeFormatSec()); + + if ($scope.iconTimeNow == 'local') + $scope.timeNow = moment().format(NVRDataModel.getTimeFormatSec()); + else + $scope.timeNow = moment().tz(NVRDataModel.getTimeZoneNow()).format(NVRDataModel.getTimeFormatSec()); + //$scope.timeNow = moment().format(NVRDataModel.getTimeFormatSec()); //console.log ("Inside Montage timer..."); @@ -878,15 +883,37 @@ angular.module('zmApp.controllers') }); + $scope.toggleTimeType = function() + { + if (NVRDataModel.isTzSupported()) + { + if ($scope.iconTimeNow == 'server') + $scope.iconTimeNow = 'local'; + else + $scope.iconTimeNow = 'server'; + } + else + NVRDataModel.debug ("timezone API not supported, can't display"); + }; + $scope.$on('$ionicView.afterEnter', function () { NVRDataModel.debug("Setting image mode to snapshot, will change to image when packery is all done"); $scope.areImagesLoading = true; $scope.isDragabillyOn = false; - $scope.timeNow = moment().format(NVRDataModel.getTimeFormatSec()); - - + + if (NVRDataModel.isTzSupported()) + $scope.iconTimeNow = 'server'; + else + $scope.iconTimeNow = 'local'; + + if ($scope.iconTimeNow == 'local') + $scope.timeNow = moment().format(NVRDataModel.getTimeFormatSec()); + else + $scope.timeNow = moment().tz(NVRDataModel.getTimeZoneNow()).format(NVRDataModel.getTimeFormatSec()); + + $scope.gridScale = "grid-item-50"; $scope.LoginData = NVRDataModel.getLogin(); //FIXME diff --git a/www/templates/montage.html b/www/templates/montage.html index 18280cab..9d075faf 100644 --- a/www/templates/montage.html +++ b/www/templates/montage.html @@ -16,8 +16,10 @@ <ion-nav-buttons side="right"> - - <span class="icon montage-time">{{timeNow}} </span> + <span ng-click="toggleTimeType()" class="icon montage-time"> + <i ng-class="(iconTimeNow=='server')?'icon-server':'ion-ios-location'"></i> + {{timeNow}} </span> + <button class="button button-icon button-clear ion-arrow-move" ng-click="dragToggle();"> </button> |
