Skip to main content

yupValidation

Yup provides a setLocale function that can be used to configure default validation messages based on the browser's i18n locale. @emoney/kyber-forms includes a locale object that contains expected messages for common validation errors. When creating custom forms that use yup validation you must manually import the locale and set it.

Note: the DataForm component sets the locale automatically.

import { setLocale } from 'yup';
import { yupValidation } from '@emoney/kyber-forms';

setLocale(yupValidation);

// define yup schema here