Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit 3c5c050

Browse files
lgallgal
authored andcommitted
SORMAS-Foundation#3413 use Date::after and Date::before for comparing dates
1 parent d64cbc3 commit 3c5c050

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

sormas-api/src/main/java/de/symeda/sormas/api/i18n/Captions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,6 +1110,7 @@ public interface Captions {
11101110
String Person_approximateAge = "Person.approximateAge";
11111111
String Person_approximateAgeReferenceDate = "Person.approximateAgeReferenceDate";
11121112
String Person_approximateAgeType = "Person.approximateAgeType";
1113+
String Person_armedForcesRelationType = "Person.armedForcesRelationType";
11131114
String Person_birthdate = "Person.birthdate";
11141115
String Person_birthdateDD = "Person.birthdateDD";
11151116
String Person_birthdateMM = "Person.birthdateMM";

sormas-app/app/src/main/java/de/symeda/sormas/app/component/validation/ValidationHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static void initDateIntervalValidator(ControlDateField dateFromControl, C
1818

1919
ResultCallback<Boolean> dateFromCallback = () -> {
2020
if (dateFromControl.getValue() != null && dateUntilContol.getValue() != null) {
21-
if (DateTimeComparator.getDateOnlyInstance().compare(dateFromControl.getValue(), dateUntilContol.getValue()) > 0) {
21+
if (dateFromControl.getValue().after(dateUntilContol.getValue())) {
2222
dateFromControl.enableErrorState(
2323
I18nProperties.getValidationError(Validations.beforeDate, dateFromControl.getCaption(), dateUntilContol.getCaption()));
2424
return true;
@@ -30,7 +30,7 @@ public static void initDateIntervalValidator(ControlDateField dateFromControl, C
3030

3131
ResultCallback<Boolean> dateUntilCallback = () -> {
3232
if (dateUntilContol.getValue() != null && dateFromControl.getValue() != null) {
33-
if (DateTimeComparator.getDateOnlyInstance().compare(dateUntilContol.getValue(), dateFromControl.getValue()) < 0) {
33+
if (dateUntilContol.getValue().before(dateFromControl.getValue())) {
3434
dateUntilContol.enableErrorState(
3535
I18nProperties.getValidationError(Validations.beforeDate, dateUntilContol.getCaption(), dateFromControl.getCaption()));
3636
return true;

0 commit comments

Comments
 (0)