Enum Class Format

java.lang.Object
java.lang.Enum<Format>
com.flowingcode.vaadin.addons.relativetime.Format
All Implemented Interfaces:
Serializable, Comparable<Format>, Constable

public enum Format extends Enum<Format>
Values for the format attribute on <relative-time>.
  • Enum Constant Details

    • RELATIVE

      public static final Format RELATIVE
      Relative phrase ("3 days ago"). Uses Intl.RelativeTimeFormat under the hood and collapses past times under ~55 seconds to "now" regardless of the Precision setting. This is a signed-int threshold in the upstream element, not something the wrapper can override. If you need continuous second-by-second ticking from zero, use DURATION or MICRO.
    • DURATION

      public static final Format DURATION
      Duration breakdown ("3d 4h", "1m 5s"). Ticks every second from zero with no "now" threshold, making it the right choice for live elapsed-time displays. Re-renders on every second boundary while the displayed value contains seconds.
    • DATETIME

      public static final Format DATETIME
      Absolute formatted date-time. Does not tick: once rendered, the displayed string doesn't change unless the inputs do. Use setTimeZone, setTimeZoneName, and the per-part setters (setYear, etc.) to shape the output.
    • AUTO

      public static final Format AUTO
      Alias for RELATIVE (the upstream default). Same behaviour, same "now" plateau for past times under ~55 seconds.
    • ELAPSED

      public static final Format ELAPSED
      Elapsed-time style. Routes through the same duration-format path as DURATION; ticks second-by-second with no "now" threshold.
    • MICRO

      public static final Format MICRO
      Compact single-unit form ("3d", "5h", "2m"). Re-renders only when the displayed unit changes, so it ticks less frequently than DURATION. Good when space is tight (badges, table cells).
  • Method Details

    • values

      public static Format[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Format valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null