refactor de la méthode isNowBetween pour ajouter un paramètre 'inclusive'
This commit is contained in:
parent
30110894db
commit
c0f9faaf73
3 changed files with 10 additions and 2 deletions
BIN
.DS_Store
vendored
BIN
.DS_Store
vendored
Binary file not shown.
BIN
tutoRefactoring/.DS_Store
vendored
BIN
tutoRefactoring/.DS_Store
vendored
Binary file not shown.
|
|
@ -1,8 +1,16 @@
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
public class DateUtils {
|
public class DateUtils {
|
||||||
public static boolean isNowBetween(LocalDate startingDate, LocalDate endingDate) {
|
public static boolean isNowBetween(LocalDate startingDate, LocalDate endingDate, boolean inclusive) {
|
||||||
return isaBoolean(startingDate, endingDate, LocalDate.now());
|
return inclusive ? isaBoolean(
|
||||||
|
startingDate.minusDays(1),
|
||||||
|
endingDate.plusDays(1),
|
||||||
|
LocalDate.now()
|
||||||
|
) : isaBoolean(
|
||||||
|
startingDate,
|
||||||
|
endingDate,
|
||||||
|
LocalDate.now()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isaBoolean(LocalDate startingDate, LocalDate endingDate, LocalDate now) {
|
private static boolean isaBoolean(LocalDate startingDate, LocalDate endingDate, LocalDate now) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue