|
|
@@ -15,24 +15,6 @@ public class DateTimeUtils1 {
|
|
|
return mapNullable(date, v -> v.withMinute(0).withHour(0).withSecond(0).withNano(0));
|
|
|
}
|
|
|
|
|
|
- public static ZonedDateTime min(ZonedDateTime firstDate, ZonedDateTime secondDate) {
|
|
|
- if (firstDate == null && secondDate == null) return null;
|
|
|
- if (firstDate == null) return secondDate;
|
|
|
- if (secondDate == null) return firstDate;
|
|
|
- return firstDate.isBefore(secondDate)
|
|
|
- ? firstDate
|
|
|
- : secondDate;
|
|
|
- }
|
|
|
-
|
|
|
- public static ZonedDateTime max(ZonedDateTime firstDate, ZonedDateTime secondDate) {
|
|
|
- if (firstDate == null && secondDate == null) return null;
|
|
|
- if (firstDate == null) return secondDate;
|
|
|
- if (secondDate == null) return firstDate;
|
|
|
- return firstDate.isBefore(secondDate)
|
|
|
- ? secondDate
|
|
|
- : firstDate;
|
|
|
- }
|
|
|
-
|
|
|
public static boolean dateBetweenWithMinMax(ZonedDateTime testedDate, ZonedDateTime dateFrom, ZonedDateTime dateTo) {
|
|
|
return dateBetweenWithMinMax(testedDate, dateFrom, dateTo, false);
|
|
|
}
|
|
|
@@ -48,16 +30,8 @@ public class DateTimeUtils1 {
|
|
|
return !testedDate.isBefore(valueOrMin(dateFrom)) && !testedDate.isAfter(dateTo);
|
|
|
}
|
|
|
|
|
|
- public static ZonedDateTime valueOrMin(ZonedDateTime date) {
|
|
|
- return ofNullable(date).orElseGet(() -> MIN);
|
|
|
- }
|
|
|
-
|
|
|
- public static ZonedDateTime valueOrMax(ZonedDateTime date) {
|
|
|
- return ofNullable(date).orElseGet(() -> MAX);
|
|
|
- }
|
|
|
-
|
|
|
public static ZonedDateTime addTimeToDate(String dateValue, String timeValue) {
|
|
|
- if(dateValue != null) {
|
|
|
+ if(dateValue == null) {
|
|
|
return null;
|
|
|
}
|
|
|
ZonedDate1 zonedDate = parseToPolishDate(dateValue);
|
|
|
@@ -76,9 +50,7 @@ public class DateTimeUtils1 {
|
|
|
return dateTime.with(LocalTime.MAX);
|
|
|
}
|
|
|
|
|
|
- public static boolean isSameDate(ZonedDateTime dateTime1, ZonedDateTime dateTime2) {
|
|
|
- return dateTime1.truncatedTo(ChronoUnit.DAYS).isEqual(dateTime2.truncatedTo(ChronoUnit.DAYS));
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
public static boolean isMinTime(ZonedDateTime dateTime) {
|
|
|
return LocalTime.MIN.equals(dateTime.toLocalTime());
|