class DateUtil extends AbstractCaller {

    @Description("Returns the difference between minuend and subtrahend date/time in specified date component<br/>"
            + "The following date components are defined:"
            + DATE_TIME_COMPONENTS_TABLE
            + "Example: #{diffDateTime(minuend, subtrahend, dateComponent)}")
    @UtilityMethod
    public long diffDateTime(LocalDateTime minuend, LocalDateTime subtrahend, String dateComponent) {
        Objects.requireNonNull(dateComponent, "datePart argument is null");
        Objects.requireNonNull(minuend, "The first argument is null");
        Objects.requireNonNull(subtrahend, "The second argument is null");
        DateComponent enumDateComponent = DateComponent.parse(dateComponent);
        if (enumDateComponent != null) {
            return enumDateComponent.diff(minuend, subtrahend);
        } else {
            throw new IllegalArgumentException("Unsupported date component " + dateComponent);
        }
    }

}