public static String toPeriodOrDurationStr(final Instant from, final Instant to) {
        final Duration duration = Duration.between(from, to);
        return duration.compareTo(PERIOD_DURATION_THRESHOLD) < 0
                ? duration.toString()
                : Period.between(
                        LocalDate.ofInstant(from, ZoneOffset.UTC),
                        LocalDate.ofInstant(to, ZoneOffset.UTC)).toString();
    }
If time is in the past then return the period from time until now().
If time is in the future then return the period from now() until time.
stroom-util/src/main/java/stroom/util/time/TimeUtils.java