Package com.atlassian.jira.util
Class JiraDurationUtils.DaysDurationFormatter
java.lang.Object
com.atlassian.jira.util.JiraDurationUtils.DaysDurationFormatter
- All Implemented Interfaces:
JiraDurationUtils.DurationFormatter
- Enclosing class:
JiraDurationUtils
public static class JiraDurationUtils.DaysDurationFormatter
extends Object
implements JiraDurationUtils.DurationFormatter
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.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDaysDurationFormatter(int hoursPerDay, I18nHelper i18nBean) Deprecated.#DaysDurationFormatter(BigDecimal, I18nHelper) is preferred now that we can fractional number of hours per dayDaysDurationFormatter(BigDecimal hoursPerDay, I18nHelper i18nBean) -
Method Summary
Modifier and TypeMethodDescriptionConverts the given time duration into days and formats it based on the system locale.Converts the given time duration into days and formats it based on the given user's locale.shortFormat(Long duration) Formats a given time duration with given locale in the most compact way possible.shortFormat(Long duration, Locale locale) Formats a given time duration with the given locale in the most compact way possible
-
Field Details
-
KEY_FORMAT_DAYS
- See Also:
-
-
Constructor Details
-
DaysDurationFormatter
Deprecated.#DaysDurationFormatter(BigDecimal, I18nHelper) is preferred now that we can fractional number of hours per day- Parameters:
hoursPerDay- numbers of hours in a dayi18nBean- i18nHelper to translate strings
-
DaysDurationFormatter
-
-
Method Details
-
getI18nKey
- Specified by:
getI18nKeyin interfaceJiraDurationUtils.DurationFormatter
-
format
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.- Specified by:
formatin interfaceJiraDurationUtils.DurationFormatter- Parameters:
duration- time duration to format- Returns:
- formatted time duration or an empty string
-
format
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.- Specified by:
formatin interfaceJiraDurationUtils.DurationFormatter- Parameters:
duration- time duration to formatlocale- user's locale- Returns:
- formatted time duration or an empty string
-
shortFormat
Description copied from interface:JiraDurationUtils.DurationFormatterFormats a given time duration with given locale in the most compact way possible.- Specified by:
shortFormatin interfaceJiraDurationUtils.DurationFormatter- Parameters:
duration- time duration to format- Returns:
- formatted time duration
-
shortFormat
Description copied from interface:JiraDurationUtils.DurationFormatterFormats a given time duration with the given locale in the most compact way possible- Specified by:
shortFormatin interfaceJiraDurationUtils.DurationFormatter- Parameters:
duration- time duration in secondslocale- locale to use- Returns:
- formatted time duration
-
getHoursPerDay
-