GUACAMOLE-422: Implement client-side timezone detection.

This commit is contained in:
Nick Couchman
2018-06-02 21:04:01 -04:00
committed by Virtually Nick
parent 8b443dc9d5
commit ea913c98fe
7 changed files with 45 additions and 6 deletions

View File

@@ -98,6 +98,17 @@ angular.module('settings').provider('preferenceService', ['$injector',
return language.replace(/-/g, '_');
};
/**
* Return the timezone detected for the current browser session
* by the JSTZ timezone library.
*
* @returns String
* The name of the currently-detected timezone.
*/
var getDetectedTimezone = function getDetectedTimezone() {
return jstz.determine().name();
};
/**
* All currently-set preferences, as name/value pairs. Each property name
@@ -128,7 +139,13 @@ angular.module('settings').provider('preferenceService', ['$injector',
*
* @type String
*/
language : getDefaultLanguageKey()
language : getDefaultLanguageKey(),
/**
* The timezone set by the uesr.
* @type String
*/
timezone : getDetectedTimezone()
};