public interface TimeZoneService extends UserTimeZoneSupplier
user.timezone. When not explicitly set the
the JVM inherits the the time zone from the launching user. This zone is used for most non-display
related tasks, such as log timestamps.
It is also the default time zone when no other can be found. See getJvmTimeZone().
setServerTimeZone(ZoneId) and
getServerTimeZone().
Given a user the lookup for a time zone returns the first configured time zone of user, server and JVM
in that order. There will always be a JVM time zone to return if all else fails. See
UserTimeZoneSupplier.getTimeZone() and UserTimeZoneSupplier.getTimeZone(ApplicationUser).
UserTimeZoneSupplier| Modifier and Type | Method and Description |
|---|---|
ZoneId |
getDefaultTimeZone() |
ZoneId |
getJvmTimeZone() |
Optional<ZoneId> |
getServerTimeZone()
Return the configured server time zone.
|
Optional<ZoneId> |
getUserTimeZone()
Return the time zone the current user has explicitly configured.
|
void |
setServerTimeZone(ZoneId zone)
Set the server time zone.
|
void |
setUserTimeZone(ZoneId zone)
Set the time zone of the current user.
|
getTimeZone, getTimeZone@Nonnull ZoneId getDefaultTimeZone()
getJvmTimeZone() if necessary.@Nonnull Optional<ZoneId> getServerTimeZone()
Optional.empty() will be returned if no server time zone is
configured.@Nonnull Optional<ZoneId> getUserTimeZone()
Optional.empty()
when no time zone is configured.
NOTE: Use UserTimeZoneSupplier.getTimeZone() when looking up the time zone that is applicable to the current user (e.g.
when rendering dates). The getTimeZone method will always return a time zone by falling back to a
set of defaults.
Optional.empty() if there is none.void setServerTimeZone(@Nullable ZoneId zone)
null may be passed to clear the setting.zone - the zone of configure or null to clear the setting.void setUserTimeZone(@Nullable ZoneId zone)
zone - the time zone to set for the current user. null may be passed
to indicate the user has no configured time zone.AuthorisationException - if called anonymouslyIllegalUserStateException - if the context user type does not support setting
a time zone.Copyright © 2019 Atlassian. All rights reserved.