diff --git a/UI/PreferencesUI/UIxJSONPreferences.m b/UI/PreferencesUI/UIxJSONPreferences.m index aed982837..d97388a21 100644 --- a/UI/PreferencesUI/UIxJSONPreferences.m +++ b/UI/PreferencesUI/UIxJSONPreferences.m @@ -1,6 +1,6 @@ /* UIxJSONPreferences.m - this file is part of SOGo * - * Copyright (C) 2007-2021 Inverse inc. + * Copyright (C) 2007-2022 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,6 +19,7 @@ */ #import +#import #import #import @@ -402,6 +403,9 @@ static SoProduct *preferencesProduct = nil; [locale objectForKey: @"NSShortWeekDayNameArray"], @"shortDays", nil] forKey: @"locale"]; + // Add timezone offset + [values setObject: [NSNumber numberWithInt: [[defaults timeZone] secondsFromGMT]] forKey: @"UserTimeZoneSecondsFromGMT"]; + accounts = [NSMutableArray arrayWithArray: [values objectForKey: @"AuxiliaryMailAccounts"]]; if ([accounts count]) { diff --git a/UI/WebServerResources/js/Scheduler/sgNowLine.directive.js b/UI/WebServerResources/js/Scheduler/sgNowLine.directive.js index 037208623..7bc13b0ed 100644 --- a/UI/WebServerResources/js/Scheduler/sgNowLine.directive.js +++ b/UI/WebServerResources/js/Scheduler/sgNowLine.directive.js @@ -46,8 +46,8 @@ /** * @ngInject */ - sgNowLineController.$inject = ['$scope', '$element', '$timeout']; - function sgNowLineController($scope, $element, $timeout) { + sgNowLineController.$inject = ['$scope', '$element', '$timeout', 'Preferences']; + function sgNowLineController($scope, $element, $timeout, Preferences) { var _this = this, updater, scrollViewCtrl = $element.controller('sgCalendarScrollView'); @@ -62,15 +62,20 @@ function _updateLine(force) { - var now = new Date(), // TODO: adjust to user's timezone - nowDay = now.getDayString(), - hours = now.getHours(), - hourHeight = $scope.quarterHeight * 4, - minutes = now.getMinutes(), - minuteHeight = $scope.quarterHeight/15, - position = parseInt(hours * hourHeight + - minutes * minuteHeight - - 1); + var now = new Date(), nowDay, hours, hourHeight, minutes, minuteHeight, position; + + // Adjust to user's timezone + now.setTime(now.getTime() + + now.getTimezoneOffset() * 60 * 1000 + + Preferences.defaults.UserTimeZoneSecondsFromGMT * 1000); + nowDay = now.getDayString(); + hours = now.getHours(); + hourHeight = $scope.quarterHeight * 4; + minutes = now.getMinutes(); + minuteHeight = $scope.quarterHeight/15; + position = parseInt(hours * hourHeight + + minutes * minuteHeight - + 1); if (force || nowDay != $scope.nowDay) { if ($scope.lineElement)