Skip to content

Commit

Permalink
MAT-7570: Set Date Shift lower limit to 1900.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkotanchik-SB committed Aug 29, 2024
1 parent 38aaef3 commit 05505d8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ void shiftDates(Base baseResource, int shiftBy) {
ZonedDateTime shifted = date.atZone(ZoneId.of("UTC")).plusYears(shiftBy);
if (shifted.getYear() > 9999) {
dateType.setValue(DateUtils.setYears(dateType.getValue(), 9999));
} else if (shifted.getYear() < 0) {
dateType.setValue(DateUtils.setYears(dateType.getValue(), 1));
} else if (shifted.getYear() < 1900) {
dateType.setValue(DateUtils.setYears(dateType.getValue(), 1900));
} else {
dateType.add(1, shiftBy);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,6 @@ void limitsLowerYearRangeTo0() {
Date originalBirthDate = (Date) patient.getBirthDate().clone();
int shiftBy = -1000000; // years
testCaseDateShifterService.shiftDates(patient, shiftBy);
assertEquals(DateUtils.setYears(originalBirthDate, 1), patient.getBirthDate());
assertEquals(DateUtils.setYears(originalBirthDate, 1900), patient.getBirthDate());
}
}

0 comments on commit 05505d8

Please sign in to comment.