@Override public Object getPreviousValue() { // Calendar cal = Calendar.getInstance(); // cal.setTime(value.getTime()); // cal.add(calendarField, -1); // Date prev = cal.getTime(); ChronoLocalDateTime<?> prev = value.minus(1, temporalUnit); return Objects.isNull(start) || start.compareTo(prev) <= 0 ? prev : null; }
@Override public Object getNextValue() { // Calendar cal = Calendar.getInstance(); // cal.setTime(value.getTime()); // cal.add(calendarField, 1); // Date next = cal.getTime(); ChronoLocalDateTime<?> next = value.plus(1, temporalUnit); return Objects.isNull(end) || end.compareTo(next) >= 0 ? next : null; }