diff --git a/new-lamassu-admin/src/pages/Customers/Wizard.jsx b/new-lamassu-admin/src/pages/Customers/Wizard.jsx index 39924da6..0d49f2b4 100644 --- a/new-lamassu-admin/src/pages/Customers/Wizard.jsx +++ b/new-lamassu-admin/src/pages/Customers/Wizard.jsx @@ -147,19 +147,25 @@ const Wizard = ({ onSubmit={onContinue} initialValues={stepOptions.initialValues} validationSchema={stepOptions.schema}> -
+ {({ errors }) => ( + + )} > diff --git a/new-lamassu-admin/src/pages/Customers/helper.jsx b/new-lamassu-admin/src/pages/Customers/helper.jsx index cbeb4c9d..20262137 100644 --- a/new-lamassu-admin/src/pages/Customers/helper.jsx +++ b/new-lamassu-admin/src/pages/Customers/helper.jsx @@ -453,14 +453,16 @@ const customerDataSchemas = { documentNumber: Yup.string().required(), dateOfBirth: Yup.string() .test({ - test: val => isValid(parse(new Date(), 'yyyy-MM-dd', val)) + test: val => isValid(parse(new Date(), 'yyyy-MM-dd', val)), + message: 'Date must be in format YYYY-MM-DD' }) .required(), gender: Yup.string().required(), country: Yup.string().required(), expirationDate: Yup.string() .test({ - test: val => isValid(parse(new Date(), 'yyyy-MM-dd', val)) + test: val => isValid(parse(new Date(), 'yyyy-MM-dd', val)), + message: 'Date must be in format YYYY-MM-DD' }) .required() }), @@ -543,9 +545,12 @@ const tryFormatDate = rawDate => { } const formatDates = values => { - R.forEach(elem => { - values[elem] = tryFormatDate(values[elem]) - })(['dateOfBirth', 'expirationDate']) + R.map( + elem => + (values[elem] = format('yyyyMMdd')( + parse(new Date(), 'yyyy-MM-dd', values[elem]) + )) + )(['dateOfBirth', 'expirationDate']) return values }