Class Dates

java.lang.Object
io.jenkins.plugins.batchcontrol.ui.Dates

@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public final class Dates extends Object
The plugin's only time-rendering vocabulary (U-07). Every timestamp and span shown on a screen goes through these three methods so that the same kind of value never reads two ways on two screens (grant durations are rendered elsewhere):
  • a point in time is always absolute, yyyy-MM-dd HH:mm:ss z in the plugin clock's zone (BatchClock.clock().getZone(), read on every call) — format(java.time.Instant);
  • a length of time (a build's duration) is always a span, 3 min 20 sec — span(long);
  • a countdown to a known instant is the same span vocabulary — until(java.time.Instant).

Absolute is the default because these screens are an audit trail: "2026-09-26 14:21:20 KST" is what an operator correlates against a build log or an incident timeline, and it does not change meaning when the page is left open or pasted into a ticket. A span is used only where the value genuinely is a length rather than a moment — a duration, and the remaining life of a grant window, where "12 min 30 sec" is the number the user is acting on and the absolute expiry is shown in the neighbouring column anyway.

  • Method Details

    • format

      public static String format(@CheckForNull Instant instant)
      Returns:
      the formatted timestamp, or an empty string for null (e.g. undecided requests).
    • span

      public static String span(long millis)
      A length of time in the one span vocabulary the plugin uses (3 min 20 sec).
      Parameters:
      millis - the length in milliseconds
      Returns:
      the span, or an empty string for a non-positive length
    • until

      public static String until(@CheckForNull Instant instant)
      How much time is left until instant, read off the BatchClock like every other time read in the plugin.
      Parameters:
      instant - the deadline, possibly null
      Returns:
      the remaining span in the same vocabulary as span(long), "expired" once the deadline has passed, or an empty string when there is no deadline