From 271506657592ead35ff6907d92bd2124048bec2a Mon Sep 17 00:00:00 2001 From: Alex Soloviev Date: Wed, 10 Apr 2024 16:17:13 -0300 Subject: [PATCH] ADO-168541: Address a11y issue, provide a good error message when the age is NaN (#1042) * provide a good error message when the age is NaN * delete comment * delete css comment --- styles/globals.css | 2 -- utils/api/definitions/schemas.ts | 10 ++++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/styles/globals.css b/styles/globals.css index 7832ce38d..c49d4614e 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -360,5 +360,3 @@ font-size: 12px; } } - -{{/* just a comment */}} \ No newline at end of file diff --git a/utils/api/definitions/schemas.ts b/utils/api/definitions/schemas.ts index 045848885..0167f62f1 100644 --- a/utils/api/definitions/schemas.ts +++ b/utils/api/definitions/schemas.ts @@ -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() @@ -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()