public static class

JiraDurationUtils.DaysDurationFormatter

extends Object
implements JiraDurationUtils.DurationFormatter
java.lang.Object
   ↳ com.atlassian.jira.util.JiraDurationUtils.DaysDurationFormatter

Class Overview

This formatter formats time duration to days only. The resulting string returned is a real number representing the number of days. This value is then formatted according to system or user's locale.

Summary

Constants
String KEY_FORMAT_DAYS
Public Constructors
JiraDurationUtils.DaysDurationFormatter(int hoursPerDay, I18nHelper i18nBean)
This constructor is deprecated. #DaysDurationFormatter(BigDecimal, I18nHelper) is preferred now that we can fractional number of hours per day
JiraDurationUtils.DaysDurationFormatter(BigDecimal hoursPerDay, I18nHelper i18nBean)
Public Methods
String format(Long duration, Locale locale)
Converts the given time duration into days and formats it based on the given user's locale.
String format(Long duration)
Converts the given time duration into days and formats it based on the system locale.
BigDecimal getHoursPerDay()
String getI18nKey()
String shortFormat(Long duration, Locale locale)
Formats a given time duration with the given locale in the most compact way possible
String shortFormat(Long duration)
Formats a given time duration with given locale in the most compact way possible.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.util.JiraDurationUtils.DurationFormatter

Constants

public static final String KEY_FORMAT_DAYS

Constant Value: "admin.globalsettings.timetracking.format.days"

Public Constructors

public JiraDurationUtils.DaysDurationFormatter (int hoursPerDay, I18nHelper i18nBean)

This constructor is deprecated.
#DaysDurationFormatter(BigDecimal, I18nHelper) is preferred now that we can fractional number of hours per day

Parameters
hoursPerDay numbers of hours in a day
i18nBean i18nHelper to translate strings

public JiraDurationUtils.DaysDurationFormatter (BigDecimal hoursPerDay, I18nHelper i18nBean)

Public Methods

public String format (Long duration, Locale locale)

Converts the given time duration into days and formats it based on the given user's locale. If the duration given is a negative number, returns an empty string.

Parameters
duration time duration to format
locale user's locale
Returns
  • formatted time duration or an empty string

public String format (Long duration)

Converts the given time duration into days and formats it based on the system locale. If the duration given is a negative number, returns an empty string.

Parameters
duration time duration to format
Returns
  • formatted time duration or an empty string

public BigDecimal getHoursPerDay ()

public String getI18nKey ()

public String shortFormat (Long duration, Locale locale)

Formats a given time duration with the given locale in the most compact way possible

Parameters
duration time duration in seconds
locale locale to use
Returns
  • formatted time duration

public String shortFormat (Long duration)

Formats a given time duration with given locale in the most compact way possible.

Parameters
duration time duration to format
Returns
  • formatted time duration