goog.locale.timeZoneDetection
Functions
detectTimeZone( opt_country, opt_date ) → string
string
Detects browser's time zone setting. If user's country is known, a better
time zone choice could be guessed. Note that in many browsers this is
available natively as new Intl.DateTimeFormat().resolvedOptions().timeZone
.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
getFingerprint( date ) → number
number
Returns an array of time zones that are consistent with user's platform setting. If user's country is given, only the time zone for that country is returned.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
useNativeTimezoneDetectionForTesting( useNative ) → void
void
Allows disabling the use of native APIs so that the fingerprinting algorithm can be tested.
Parameters |
|
---|
Compiler Constants
goog.locale.timeZoneDetection.INCLUDE_FINGERPRINT_DETECTION → boolean
boolean
Whether to include the fingerprint algorithm so it can be used as a fallback. Without this, the code may be stripped for modern browsers that can be assumed to support the native API.
goog.locale.timeZoneDetection.USE_NATIVE_TIMEZONE_DETECTION → boolean
boolean
Whether to use the native API for time zone detection (if the runtime supports it). You might turn this off if a downstream system can't handle a user's timezone as reported by the browser.