Skip to content

Commit

Permalink
MAT-7570: Limit date range of Birthdate during date shift requests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkotanchik-SB committed Sep 5, 2024
1 parent 5102ccd commit bedffae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>gov.cms.madie</groupId>
<artifactId>madie-java-models</artifactId>
<version>0.6.60-SNAPSHOT</version>
<version>00.6.61-SNAPSHOT</version>
<name>madie-java-models</name>
<description>Java based models for MADiE microservices</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ public ZonedDateTime shiftDateByYear(int year) {
if (this.birthDatetime == null) {
return null;
}
return this.birthDatetime.plusYears(year);
ZonedDateTime shiftedDateTime = birthDatetime.plusYears(year);
if (shiftedDateTime.getYear() > 9999) {
return shiftedDateTime.withYear(9999);
}
if (shiftedDateTime.getYear() < 1900) {
return shiftedDateTime.withYear(1900);
}
return shiftedDateTime;
}
}

0 comments on commit bedffae

Please sign in to comment.