Class DurationFormatter

java.lang.Object
com.guflimc.brick.i18n.api.time.DurationFormatter

public class DurationFormatter extends Object
  • Field Details

    • FLAG_SKIP_ZERO

      public static final int FLAG_SKIP_ZERO
      A value of a temporal field will not be formatted in the final result if the temporal field's value for the given temporal amount is zero. e.g. if the temporal amount is 2 years and 17 days, the result will be "2y 17d" and not "2y 0m 17d".
      See Also:
    • FLAG_SKIP_OUT_OF_UPPER_BOUND

      public static final int FLAG_SKIP_OUT_OF_UPPER_BOUND
      A value of a temporal field will not be formatted in the final result if the temporal amount is less than the temporal field's base unit duration. e.g. if the temporal amount is 3 months and 24 days, the result will be "3m 24d" and not "0y 3m 24d".
      See Also:
    • FLAG_SKIP_OUT_OF_LOWER_BOUND

      public static final int FLAG_SKIP_OUT_OF_LOWER_BOUND
      A value of a temporal field will not be formatted in the final result if the temporal field's value and any subsequent temporal field's value in the format for the given temporal amount is zero. This only applies when at least one prior temporal field's value is non-zero. e.g. if the temporal amount is 1 year and 7 months, the result will be "1y 7m" and not "1y 7m 0d".
      See Also:
    • DIGITAL

      public static final DurationFormatter DIGITAL
      Digital clock format. e.g. for 7 hours, 38 minutes and 12 seconds, the result will be "07:38:12".
    • COZY

      public static final DurationFormatter COZY
      Cozy format with period and duration. e.g. for 3 days and 38 minutes the result will be "3D 0h 38m".
    • COMPACT

      public static final DurationFormatter COMPACT
      Compact format with period and duration. e.g. for 3 days and 38 minutes the result will be "3D 38m".
    • HIGHEST

      public static final DurationFormatter HIGHEST
      Format only the highest unit of value. e.g. for 7 months, 26 days and 22 hours the result will be "7m".
  • Method Details