A small method to check if a LocalDataTime is in a Range between to other LocalDateTime - Objects.
private boolean isInDateRange(
LocalDateTime upper,
LocalDateTime lower,
LocalDateTime toCheck) {
var isUpper = toCheck.equals(upper);
var isLower = toCheck.equals(lower);
if (isLower || isUpper) {
return true;
}
return toCheck.isBefore(upper) && toCheck.isAfter(lower);
}