mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 23:13:10 +00:00
dspace-api: use minusDays and minusWeeks helpers
IntelliJ suggested we use minusDays and minusWeeks helpers.
(cherry picked from commit 125767af6e
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
f442436580
commit
63a2a160f8
@@ -44,14 +44,12 @@ public enum FrequencyType {
|
|||||||
case "D":
|
case "D":
|
||||||
// Frequency is anything updated yesterday.
|
// Frequency is anything updated yesterday.
|
||||||
// startDate is beginning of day yesterday
|
// startDate is beginning of day yesterday
|
||||||
Instant startOfYesterday = ZonedDateTime.now(ZoneOffset.UTC)
|
Instant startOfYesterday = ZonedDateTime.now(ZoneOffset.UTC).minusDays(1)
|
||||||
.minus(1, ChronoUnit.DAYS)
|
|
||||||
.with(LocalTime.MIN)
|
.with(LocalTime.MIN)
|
||||||
.toInstant();
|
.toInstant();
|
||||||
startDate = startOfYesterday.toString();
|
startDate = startOfYesterday.toString();
|
||||||
// endDate is end of day yesterday
|
// endDate is end of day yesterday
|
||||||
Instant endOfYesterday = ZonedDateTime.now(ZoneOffset.UTC)
|
Instant endOfYesterday = ZonedDateTime.now(ZoneOffset.UTC).minusDays(1)
|
||||||
.minus(1, ChronoUnit.DAYS)
|
|
||||||
.with(LocalTime.MAX)
|
.with(LocalTime.MAX)
|
||||||
.toInstant();
|
.toInstant();
|
||||||
endDate = endOfYesterday.toString();
|
endDate = endOfYesterday.toString();
|
||||||
@@ -75,15 +73,13 @@ public enum FrequencyType {
|
|||||||
case "W":
|
case "W":
|
||||||
// Frequency is anything updated last week
|
// Frequency is anything updated last week
|
||||||
// startDate is beginning of last week (Sunday, beginning of the day)
|
// startDate is beginning of last week (Sunday, beginning of the day)
|
||||||
Instant startOfLastWeek = ZonedDateTime.now(ZoneOffset.UTC)
|
Instant startOfLastWeek = ZonedDateTime.now(ZoneOffset.UTC).minusWeeks(1)
|
||||||
.minus(1, ChronoUnit.WEEKS)
|
|
||||||
.with(previousOrSame(DayOfWeek.SUNDAY))
|
.with(previousOrSame(DayOfWeek.SUNDAY))
|
||||||
.with(LocalTime.MIN)
|
.with(LocalTime.MIN)
|
||||||
.toInstant();
|
.toInstant();
|
||||||
startDate = startOfLastWeek.toString();
|
startDate = startOfLastWeek.toString();
|
||||||
// End date is end of last week (Saturday, end of day)
|
// End date is end of last week (Saturday, end of day)
|
||||||
Instant endOfLastWeek = ZonedDateTime.now(ZoneOffset.UTC)
|
Instant endOfLastWeek = ZonedDateTime.now(ZoneOffset.UTC).minusWeeks(1)
|
||||||
.minus(1, ChronoUnit.WEEKS)
|
|
||||||
.with(nextOrSame(DayOfWeek.SATURDAY))
|
.with(nextOrSame(DayOfWeek.SATURDAY))
|
||||||
.with(LocalTime.MAX)
|
.with(LocalTime.MAX)
|
||||||
.toInstant();
|
.toInstant();
|
||||||
|
Reference in New Issue
Block a user