Interface TimezoneResolverService
- All Known Implementing Classes:
TimezoneResolverServiceImpl
public interface TimezoneResolverService
Service for dealing with time zones.
-
Method Summary
Modifier and TypeMethodDescriptionorg.joda.time.DateTimeZone
getCurrentDateTimeForGuiTimezone
(Locale locale, @Nullable String pattern) org.joda.time.DateTimeZone
Returns the project-specific default timezone id.@Nullable org.joda.time.DateTimeZone
@Nullable String
Returns the gui timezone id for the current user to be used in the gui right now.withBestTimezone
(org.joda.time.DateTimeZone dateTimeZone) Use a specifiedDateTimeZone
as 'best' timezone (i.e.Use the system's default timezone (i.e.
-
Method Details
-
getDefaultTimezoneId
String getDefaultTimezoneId()Returns the project-specific default timezone id.- Returns:
- olson-tz name.
-
getTimezoneIdForGui
Returns the gui timezone id for the current user to be used in the gui right now.- Returns:
- olson-tz name, or
null
if unknown.
-
getBestTimezoneId
String getBestTimezoneId()- Returns:
- the id of the
user's timezone
if available, falls back to the id of theproject's default timezone
.
-
getDefaultTimeZone
org.joda.time.DateTimeZone getDefaultTimeZone()- Returns:
- the project-specific default timezone
-
getBestTimezone
org.joda.time.DateTimeZone getBestTimezone()- Returns:
- the
user's timezone
if available, falls back to theproject's default timezone
-
getTimezoneForGui
@Nullable @Nullable org.joda.time.DateTimeZone getTimezoneForGui()- Returns:
- returns the gui timezone for the current user
-
getCurrentDateTimeForGuiTimezone
- Parameters:
locale
- the locale to be used for the formatpattern
- an optional pattern, a pattern with style "SS" will be used if null- Returns:
- the current date and time as a formatted string
-
withBestTimezone
Use a specifiedDateTimeZone
as 'best' timezone (i.e. the timezone returned bygetBestTimezone()
instead of whatever was potentially set on the current request. Note: this does not influence calls togetTimezoneForGui()
, as this will still return the timezone as set by the current request.- Parameters:
dateTimeZone
- the timezone to be used- Returns:
- an invoker with the best timezone set to the specified timezone
-
withDefaultAsBestTimezone
Invoker withDefaultAsBestTimezone()Use the system's default timezone (i.e. the timezone returned bygetBestTimezone()
) as 'best' timezone (i.e. the timezone returned bygetBestTimezone()
instead of whatever was potentially set on the current request. Note: this does not influence calls togetTimezoneForGui()
, as this will still return the timezone as set by the current request.- Returns:
- an invoker with the best timezone set to the system's default timezone
-