Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw validation error if day, month, or year are blank in household member birthday #594

Merged
merged 2 commits into from
Feb 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public Map<String, List<String>> runValidation(FormSubmission formSubmission, Su
String year = (String) inputData.get("householdMemberBirthYear");

// valid range does not enforce year so added an additional validation here
if((day + month + year).isBlank()) {
if((day.isBlank() || month.isBlank() || year.isBlank())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think theres one extra layer of parenthesis

errorMessages.put(INPUT_NAME, List.of(translateMessage("error.format-dob")));
return errorMessages;
} else if (!Pattern.matches("\\d{4}",year)) {
errorMessages.put(INPUT_NAME, List.of(translateMessage("error.format-dob")));
Expand Down
Loading