public final void changeEndDate ( LocalDate date , boolean keepDuration ) { requireNonNull ( date ) ; Interval interval = getInterval ( ) ; LocalDateTime newEndDateTime = getEndAsLocalDateTime ( ) . with ( date ) ; LocalDateTime startDateTime = getStartAsLocalDateTime ( ) ; if ( keepDuration ) { startDateTime = newEndDateTime . minus ( getDuration ( ) ) ; setInterval ( startDateTime , newEndDateTime , getZoneId ( ) ) ; } else { /* * We might have a problem if the new end time is BEFORE the current start time. */ if ( newEndDateTime . isBefore ( startDateTime ) ) { interval = interval . withStartDateTime ( newEndDateTime . minus ( interval . getDuration ( ) ) ) ; } setInterval ( interval . withEndDate ( date ) ) ; } }
Changes the end date of the entry interval .