diff --git a/src/main/java/ca/nexapp/core/dates/DateProvider.java b/src/main/java/ca/nexapp/core/dates/DateProvider.java index 84e5048..ed21862 100644 --- a/src/main/java/ca/nexapp/core/dates/DateProvider.java +++ b/src/main/java/ca/nexapp/core/dates/DateProvider.java @@ -3,6 +3,7 @@ import java.time.DayOfWeek; import java.time.Instant; import java.time.LocalDate; +import java.time.LocalTime; import java.time.ZoneId; import java.time.ZoneOffset; import java.time.ZonedDateTime; @@ -13,6 +14,14 @@ default Instant currentTimestamp() { return currentDateTime(ZoneOffset.UTC).toInstant(); } + default ZonedDateTime atStartOfDay(ZoneId zone) { + return currentDateTime(zone).toLocalDate().atStartOfDay(zone); + } + + default ZonedDateTime atEndOfDay(ZoneId zone) { + return currentDateTime(zone).with(LocalTime.MAX); + } + ZonedDateTime currentDateTime(ZoneId zone); LocalDate currentDate(ZoneId zone);