Interface TimezoneResolverService

All Known Implementing Classes:
TimezoneResolverServiceImpl

public interface TimezoneResolverService
Service for dealing with time zones.
  • Method Details

    • getDefaultTimezoneId

      String getDefaultTimezoneId()
      Returns the project-specific default timezone id.
      Returns:
      olson-tz name.
    • getTimezoneIdForGui

      @Nullable @Nullable String 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 the project'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 the project's default timezone
    • getTimezoneForGui

      @Nullable @Nullable org.joda.time.DateTimeZone getTimezoneForGui()
      Returns:
      returns the gui timezone for the current user
    • getCurrentDateTimeForGuiTimezone

      String getCurrentDateTimeForGuiTimezone(Locale locale, @Nullable @Nullable String pattern)
      Parameters:
      locale - the locale to be used for the format
      pattern - an optional pattern, a pattern with style "SS" will be used if null
      Returns:
      the current date and time as a formatted string
    • withBestTimezone

      Invoker withBestTimezone(org.joda.time.DateTimeZone dateTimeZone)
      Use a specified DateTimeZone as 'best' timezone (i.e. the timezone returned by getBestTimezone() instead of whatever was potentially set on the current request. Note: this does not influence calls to getTimezoneForGui(), 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 by getBestTimezone()) as 'best' timezone (i.e. the timezone returned by getBestTimezone() instead of whatever was potentially set on the current request. Note: this does not influence calls to getTimezoneForGui(), 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