public static class

JiraDurationUtils.PrettyDurationFormatter

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

Class Overview

This formatter formats time duration to "pretty" format, such as 3 weeks, 2 days, 1 hour, 15 minutes. This value is formatted according to system or user's locale.

Summary

Constants
String KEY_FORMAT_PRETTY
Public Constructors
PrettyDurationFormatter(int hoursPerDay, int daysPerWeek, I18nHelper i18nBean)
PrettyDurationFormatter(BigDecimal hoursPerDay, BigDecimal daysPerWeek, I18nHelper i18nBean)
Public Methods
String format(Long duration)
Formats a given time duration with default (system) locale.
String format(Long duration, Locale locale)
Formats a given time duration with given locale.
BigDecimal getDaysPerWeek()
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)
Used by the Time Tracking report to show shorter durations than full pretty format.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.util.JiraDurationUtils.DurationFormatter

Constants

public static final String KEY_FORMAT_PRETTY

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

Public Constructors

public PrettyDurationFormatter (int hoursPerDay, int daysPerWeek, I18nHelper i18nBean)

public PrettyDurationFormatter (BigDecimal hoursPerDay, BigDecimal daysPerWeek, I18nHelper i18nBean)

Public Methods

public String format (Long duration)

Formats a given time duration with default (system) locale.

Parameters
duration time duration to format
Returns
  • formatted time duration

public String format (Long duration, Locale locale)

Formats a given time duration with given locale.

Parameters
duration time duration to format
locale user's locale
Returns
  • formatted time duration

public BigDecimal getDaysPerWeek ()

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)

Used by the Time Tracking report to show shorter durations than full pretty format.

Parameters
duration time duration to format
Returns
  • a duration String in the format "1d 3h 30m".