mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-19 02:15:36 +00:00
fix(calendar(js)): adjust line of the current time to user's timezone
Fixes #5512
This commit is contained in:
@@ -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 <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSTimeZone.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
|
||||
#import <NGObjWeb/SoObjects.h>
|
||||
@@ -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])
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user