Skip to content

Commit

Permalink
Merge pull request #96 from redlink-gmbh/FEATURE-Relative_Study_Start
Browse files Browse the repository at this point in the history
Feature relative study start
  • Loading branch information
alireza-dhp authored Dec 1, 2023
2 parents 5924d60 + 308fdaa commit 619595c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ public int getMinutes() {
}

private int getTimeGroup(int i) {
if(time == null) {
return 0;
}
Matcher m = CLOCK.matcher(time);
m.find();
return Integer.parseInt(m.group(i));
if(m.find()) {
return Integer.parseInt(m.group(i));
} else {
return 0;
}
}

public Duration getOffset() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ private static Instant shiftStartIfNecessary(Instant start) {
private static Instant toInstant(RelativeDate date, Instant start) {
return ZonedDateTime.ofInstant(start.plus(date.getOffset().getValue() - 1L, date.getOffset().getUnit().toTemporalUnit()), ZoneId.systemDefault())
.withHour(date.getHours())
.withMinute(date.getMinutes()).toInstant();
.withMinute(date.getMinutes())
.withSecond(0)
.withNano(0)
.toInstant();
}

public static List<Pair<Instant, Instant>> parseToObservationSchedulesForEvent(Event event, Instant start, Instant end) {
Expand Down

0 comments on commit 619595c

Please sign in to comment.