Skip to content

Commit

Permalink
ADO-168541: Address a11y issue, provide a good error message when the…
Browse files Browse the repository at this point in the history
… age is NaN (#1042)

* provide a good error message when the age is NaN

* delete comment

* delete css comment
  • Loading branch information
alex-solo authored Apr 10, 2024
1 parent 5844b54 commit 2715066
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 0 additions & 2 deletions styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -360,5 +360,3 @@
font-size: 12px;
}
}

{{/* just a comment */}}
10 changes: 8 additions & 2 deletions utils/api/definitions/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ export const RequestSchema = Joi.object({
//.message(ValidationErrors.incomeWorkGreaterThanNetIncome),
age: Joi.number()
.required()
.messages({ 'any.required': ValidationErrors.invalidAge })
.messages({
'any.required': ValidationErrors.invalidAge,
'number.base': ValidationErrors.invalidAge,
})
.custom(customAgeValidation, 'Custom Validation'),
receiveOAS: Joi.boolean()
.required()
Expand Down Expand Up @@ -275,7 +278,10 @@ export const RequestSchema = Joi.object({
//.message(ValidationErrors.partnerIncomeWorkGreaterThanNetIncome),
partnerAge: Joi.number()
.required()
.messages({ 'any.required': ValidationErrors.invalidAge })
.messages({
'any.required': ValidationErrors.invalidAge,
'number.base': ValidationErrors.invalidAge,
})
.custom(customAgeValidation, 'Custom Validation'),
partnerLivingCountry: Joi.string()
.required()
Expand Down

0 comments on commit 2715066

Please sign in to comment.