Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/main/java/ca/nexapp/core/dates/DateProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests are missing


ZonedDateTime currentDateTime(ZoneId zone);

LocalDate currentDate(ZoneId zone);
Expand Down