From 4146f0bde62cc32d2257f9f929f05ee7c5a9cc38 Mon Sep 17 00:00:00 2001 From: Anders Date: Fri, 11 Oct 2024 12:03:20 +0200 Subject: [PATCH] chore: adds length validator messages (#4115) --- .../NationalIdentityNumber/Examples.tsx | 4 +- .../NationalIdentityNumber.tsx | 68 +++++++--- .../__tests__/NationalIdentityNumber.test.tsx | 118 ++++++++++++++---- ...dentityNumberMinimumAgeValidator.test.tsx} | 77 ++++++------ .../OrganizationNumber/OrganizationNumber.tsx | 17 ++- .../__tests__/OrganizationNumber.test.tsx | 81 ++++++++---- .../forms/constants/locales/en-GB.ts | 12 +- .../forms/constants/locales/en-US.ts | 4 +- .../forms/constants/locales/nb-NO.ts | 12 +- 9 files changed, 283 insertions(+), 110 deletions(-) rename packages/dnb-eufemia/src/extensions/forms/Field/NationalIdentityNumber/__tests__/{NationalIdentityNumberAdultValidator.test.tsx => NationalIdentityNumberMinimumAgeValidator.test.tsx} (88%) diff --git a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/feature-fields/NationalIdentityNumber/Examples.tsx b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/feature-fields/NationalIdentityNumber/Examples.tsx index 7bf53f93db6..76775feeb0c 100644 --- a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/feature-fields/NationalIdentityNumber/Examples.tsx +++ b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/feature-fields/NationalIdentityNumber/Examples.tsx @@ -172,9 +172,9 @@ export const ValidationExtendValidator = () => { } } const myValidator = (value, { validators }) => { - const { dnrValidator, fnrValidator } = validators + const { dnrAndFnrValidator } = validators - return [dnrValidator, fnrValidator, bornInAprilValidator] + return [dnrAndFnrValidator, bornInAprilValidator] } return ( diff --git a/packages/dnb-eufemia/src/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumber.tsx b/packages/dnb-eufemia/src/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumber.tsx index 277f1f3419f..ee9f7c9c527 100644 --- a/packages/dnb-eufemia/src/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumber.tsx +++ b/packages/dnb-eufemia/src/extensions/forms/Field/NationalIdentityNumber/NationalIdentityNumber.tsx @@ -18,41 +18,68 @@ function NationalIdentityNumber(props: Props) { label, errorRequired, errorFnr, + errorFnrLength, errorDnr, + errorDnrLength, errorMinimumAgeValidator, + errorMinimumAgeValidatorLength, } = translations const errorMessages = useErrorMessage(props.path, props.errorMessages, { required: errorRequired, pattern: errorFnr, errorFnr, + errorFnrLength, errorDnr, + errorDnrLength, errorMinimumAgeValidator, + errorMinimumAgeValidatorLength, }) + const identificationNumberIsOfLength = ( + identificationNumber: string, + length: number + ) => { + return identificationNumber?.length === length + } + const fnrValidator = useCallback( (value: string) => { - if ( - value !== undefined && - (Number.parseInt(value.substring(0, 1)) > 3 || - fnr(value).status === 'invalid') - ) { - return Error(errorFnr) + if (value !== undefined) { + if (Number.parseInt(value.substring(0, 1)) > 3) { + return Error(errorFnr) + } + + const fnrIs11Digits = identificationNumberIsOfLength(value, 11) + + if (!fnrIs11Digits) { + return Error(errorFnrLength) + } + if (fnrIs11Digits && fnr(value).status === 'invalid') { + return Error(errorFnr) + } } }, - [errorFnr] + [errorFnr, errorFnrLength] ) const dnrValidator = useCallback( (value: string) => { - if ( - value !== undefined && - (Number.parseInt(value.substring(0, 1)) < 4 || - dnr(value).status === 'invalid') - ) { - return Error(errorDnr) + if (value !== undefined) { + if (Number.parseInt(value.substring(0, 1)) < 4) { + return Error(errorDnr) + } + + const dnrIs11Digits = identificationNumberIsOfLength(value, 11) + + if (!dnrIs11Digits) { + return Error(errorDnrLength) + } + if (dnrIs11Digits && dnr(value).status === 'invalid') { + return Error(errorDnr) + } } }, - [errorDnr] + [errorDnr, errorDnrLength] ) const dnrAndFnrValidator = useCallback( @@ -161,7 +188,18 @@ export function createMinimumAgeValidator(age: number) { return // stop here } - if (value.length > 6) { + const identificationNumberIs7DigitsOrMore = value?.length >= 7 + + if (!identificationNumberIs7DigitsOrMore) { + return new FormError( + 'NationalIdentityNumber.errorMinimumAgeValidatorLength', + { + validationRule: 'errorMinimumAgeValidatorLength', // "validationRule" Will be removed in future PR + } + ) + } + + if (identificationNumberIs7DigitsOrMore) { const date = getBirthDateByFnrOrDnr(value) if (getAgeByBirthDate(date) >= age) { return // stop here diff --git a/packages/dnb-eufemia/src/extensions/forms/Field/NationalIdentityNumber/__tests__/NationalIdentityNumber.test.tsx b/packages/dnb-eufemia/src/extensions/forms/Field/NationalIdentityNumber/__tests__/NationalIdentityNumber.test.tsx index 7df996c5732..838db7b71b9 100644 --- a/packages/dnb-eufemia/src/extensions/forms/Field/NationalIdentityNumber/__tests__/NationalIdentityNumber.test.tsx +++ b/packages/dnb-eufemia/src/extensions/forms/Field/NationalIdentityNumber/__tests__/NationalIdentityNumber.test.tsx @@ -372,6 +372,14 @@ describe('Field.NationalIdentityNumber', () => { '53137248022', ] + const invalidDNumTooShort = [ + '6', + '5309724803', + '5309724', + '72127248', + '5313', + ] + it.each(validDNum)('Valid D number: %s', async (dNum) => { render( @@ -384,11 +392,7 @@ describe('Field.NationalIdentityNumber', () => { it.each(invalidDNum)('Invalid D number: %s', async (dNum) => { render( - + ) fireEvent.blur(document.querySelector('input')) @@ -400,6 +404,21 @@ describe('Field.NationalIdentityNumber', () => { ) }) }) + + it.each(invalidDNumTooShort)('Invalid D number: %s', async (dNum) => { + render( + + ) + + fireEvent.blur(document.querySelector('input')) + + await waitFor(() => { + expect(screen.queryByRole('alert')).toBeInTheDocument() + expect(screen.queryByRole('alert')).toHaveTextContent( + nb.NationalIdentityNumber.errorDnrLength + ) + }) + }) }) describe('should validate Norwegian national identity number(fnr)', () => { @@ -424,6 +443,14 @@ describe('Field.NationalIdentityNumber', () => { '13137248022', ] + const invalidFnrNumTooShort = [ + '2', + '1309724803', + '1309724', + '321', + '131372480', + ] + it.each(validFnrNum)( 'Valid national identity number(fnr): %s', async (fnrNum) => { @@ -441,11 +468,7 @@ describe('Field.NationalIdentityNumber', () => { 'Invalid national identity number(fnr): %s', async (fnrNum) => { render( - + ) fireEvent.blur(document.querySelector('input')) @@ -458,6 +481,24 @@ describe('Field.NationalIdentityNumber', () => { }) } ) + + it.each(invalidFnrNumTooShort)( + 'Invalid national identity number(fnr): %s', + async (fnrNum) => { + render( + + ) + + fireEvent.blur(document.querySelector('input')) + + await waitFor(() => { + expect(screen.queryByRole('alert')).toBeInTheDocument() + expect(screen.queryByRole('alert')).toHaveTextContent( + nb.NationalIdentityNumber.errorFnrLength + ) + }) + } + ) }) describe('should extend validation using custom validator', () => { @@ -468,6 +509,8 @@ describe('Field.NationalIdentityNumber', () => { const invalidFnrNumApril = ['29040112345', '13047248032'] const invalidDNumApril = ['69040112345', '53047248032'] + const invalidFnrTooShort = ['2904011234', '1'] + const invalidDNumTooShort = ['6904011234', '5'] const validFnrNumNotApril = [ '58081633086', @@ -478,19 +521,16 @@ describe('Field.NationalIdentityNumber', () => { const invalidIds = [...validFnrNumNotApril, ...validDNumNotApril] - const bornInApril = (value: string) => - value.substring(2, 4) === '04' - ? { status: 'valid' } - : { status: 'invalid' } + const bornInAprilValidator = (value: string) => { + if (value.substring(2, 4) !== '04') { + return new Error('custom error') + } + } const customValidator: Validator = (value, { validators }) => { const { dnrAndFnrValidator } = validators - const result = bornInApril(value) - if (result.status === 'invalid') { - return new Error('custom error') - } - return [dnrAndFnrValidator] + return [dnrAndFnrValidator, bornInAprilValidator] } it.each(validIds)('Valid identity number: %s', async (fnrNum) => { @@ -510,7 +550,6 @@ describe('Field.NationalIdentityNumber', () => { ) @@ -528,7 +567,6 @@ describe('Field.NationalIdentityNumber', () => { ) @@ -541,6 +579,23 @@ describe('Field.NationalIdentityNumber', () => { }) }) + it.each(invalidDNumTooShort)('Invalid D number: %s', async (dNum) => { + render( + + ) + + await waitFor(() => { + expect(screen.queryByRole('alert')).toBeInTheDocument() + expect(screen.queryByRole('alert')).toHaveTextContent( + nb.NationalIdentityNumber.errorDnrLength + ) + }) + }) + it.each(invalidFnrNumApril)( 'Invalid national identity number(fnr): %s', async (fnr) => { @@ -548,7 +603,6 @@ describe('Field.NationalIdentityNumber', () => { ) @@ -561,5 +615,25 @@ describe('Field.NationalIdentityNumber', () => { }) } ) + + it.each(invalidFnrTooShort)( + 'Invalid national identity number(fnr): %s', + async (fnr) => { + render( + + ) + + await waitFor(() => { + expect(screen.queryByRole('alert')).toBeInTheDocument() + expect(screen.queryByRole('alert')).toHaveTextContent( + nb.NationalIdentityNumber.errorFnrLength + ) + }) + } + ) }) }) diff --git a/packages/dnb-eufemia/src/extensions/forms/Field/NationalIdentityNumber/__tests__/NationalIdentityNumberAdultValidator.test.tsx b/packages/dnb-eufemia/src/extensions/forms/Field/NationalIdentityNumber/__tests__/NationalIdentityNumberMinimumAgeValidator.test.tsx similarity index 88% rename from packages/dnb-eufemia/src/extensions/forms/Field/NationalIdentityNumber/__tests__/NationalIdentityNumberAdultValidator.test.tsx rename to packages/dnb-eufemia/src/extensions/forms/Field/NationalIdentityNumber/__tests__/NationalIdentityNumberMinimumAgeValidator.test.tsx index 17f7605768d..59809cf9c75 100644 --- a/packages/dnb-eufemia/src/extensions/forms/Field/NationalIdentityNumber/__tests__/NationalIdentityNumberAdultValidator.test.tsx +++ b/packages/dnb-eufemia/src/extensions/forms/Field/NationalIdentityNumber/__tests__/NationalIdentityNumberMinimumAgeValidator.test.tsx @@ -7,47 +7,48 @@ import nbNO from '../../../constants/locales/nb-NO' const nb = nbNO['nb-NO'] -describe('Field.NationalIdentityNumber with adultValidator', () => { +describe('Field.NationalIdentityNumber with minimumAgeValidator', () => { const errorMinimumAgeValidator = nb.NationalIdentityNumber.errorMinimumAgeValidator.replace( '{age}', '18' ) - const adultValidator = createMinimumAgeValidator(18) - const extendingDnrAndFnrValidatorWithAdultValidator: Validator< + + const minimum18YearsValidator = createMinimumAgeValidator(18) + const extendingDnrAndFnrValidatorWithMin18Validator: Validator< string > = (value, { validators }) => { const { dnrAndFnrValidator } = validators - return [dnrAndFnrValidator, adultValidator] + return [dnrAndFnrValidator, minimum18YearsValidator] } - const extendingDnrValidatorWithAdultValidator: Validator = ( + const extendingDnrValidatorWithMin18Validator: Validator = ( value, { validators } ) => { const { dnrValidator } = validators - return [dnrValidator, adultValidator] + return [dnrValidator, minimum18YearsValidator] } - const extendingFnrValidatorWithAdultValidator: Validator = ( + const extendingFnrValidatorWithMin18Validator: Validator = ( value, { validators } ) => { const { fnrValidator } = validators - return [fnrValidator, adultValidator] + return [fnrValidator, minimum18YearsValidator] } - const myAdultValidator: Validator = () => { - return [adultValidator] + const myMinimum18YearsValidator: Validator = () => { + return [minimum18YearsValidator] } it('should display error if required and validateInitially', async () => { render( @@ -64,7 +65,7 @@ describe('Field.NationalIdentityNumber with adultValidator', () => { it('should display error when value is invalid', async () => { render( @@ -73,7 +74,7 @@ describe('Field.NationalIdentityNumber with adultValidator', () => { await waitFor(() => { expect(screen.queryByRole('alert')).toBeInTheDocument() expect(screen.queryByRole('alert')).toHaveTextContent( - errorMinimumAgeValidator + nb.NationalIdentityNumber.errorMinimumAgeValidatorLength ) }) }) @@ -81,7 +82,7 @@ describe('Field.NationalIdentityNumber with adultValidator', () => { it('should not display error when validateInitially and no value', async () => { render( ) @@ -191,7 +192,7 @@ describe('Field.NationalIdentityNumber with adultValidator', () => { async (validId) => { render( { async (invalidId) => { render( { async (validId) => { render( @@ -248,7 +249,7 @@ describe('Field.NationalIdentityNumber with adultValidator', () => { async (invalidId) => { render( @@ -270,7 +271,7 @@ describe('Field.NationalIdentityNumber with adultValidator', () => { render( @@ -288,7 +289,7 @@ describe('Field.NationalIdentityNumber with adultValidator', () => { render( @@ -308,7 +309,7 @@ describe('Field.NationalIdentityNumber with adultValidator', () => { render( @@ -328,7 +329,7 @@ describe('Field.NationalIdentityNumber with adultValidator', () => { render( @@ -350,7 +351,7 @@ describe('Field.NationalIdentityNumber with adultValidator', () => { render( { render( { render( { render( { render( @@ -452,7 +453,7 @@ describe('Field.NationalIdentityNumber with adultValidator', () => { render( @@ -472,7 +473,7 @@ describe('Field.NationalIdentityNumber with adultValidator', () => { render( @@ -493,7 +494,7 @@ describe('Field.NationalIdentityNumber with adultValidator', () => { async (validDnum) => { render( @@ -510,7 +511,7 @@ describe('Field.NationalIdentityNumber with adultValidator', () => { async (invalidDnum) => { render( @@ -532,7 +533,7 @@ describe('Field.NationalIdentityNumber with adultValidator', () => { ])('Invalid d number: %s', async (invalidDnum) => { render( @@ -553,7 +554,7 @@ describe('Field.NationalIdentityNumber with adultValidator', () => { render( @@ -571,7 +572,7 @@ describe('Field.NationalIdentityNumber with adultValidator', () => { render( @@ -591,7 +592,7 @@ describe('Field.NationalIdentityNumber with adultValidator', () => { render( @@ -612,7 +613,7 @@ describe('Field.NationalIdentityNumber with adultValidator', () => { async (validFnr) => { render( @@ -629,7 +630,7 @@ describe('Field.NationalIdentityNumber with adultValidator', () => { async (invalidFnr) => { render( @@ -651,7 +652,7 @@ describe('Field.NationalIdentityNumber with adultValidator', () => { ])('Invalid identity number(fnr): %s', async (invalidFnr) => { render( diff --git a/packages/dnb-eufemia/src/extensions/forms/Field/OrganizationNumber/OrganizationNumber.tsx b/packages/dnb-eufemia/src/extensions/forms/Field/OrganizationNumber/OrganizationNumber.tsx index 0551d845680..bc34a90f4a2 100644 --- a/packages/dnb-eufemia/src/extensions/forms/Field/OrganizationNumber/OrganizationNumber.tsx +++ b/packages/dnb-eufemia/src/extensions/forms/Field/OrganizationNumber/OrganizationNumber.tsx @@ -12,21 +12,30 @@ export type Props = Omit & { function OrganizationNumber(props: Props) { const translations = useTranslation().OrganizationNumber - const { errorOrgNo, errorRequired, label } = translations + const { errorOrgNo, errorOrgNoLength, errorRequired, label } = + translations const errorMessages = useErrorMessage(props.path, props.errorMessages, { required: errorRequired, pattern: errorOrgNo, errorOrgNo, + errorOrgNoLength, }) const organizationNumberValidator = useCallback( (value: string) => { - if (value !== undefined && !isValidOrgNumber(value)) { - return Error(errorOrgNo) + if (value !== undefined) { + const orgNoIs9Digits = value?.length === 9 + + if (!orgNoIs9Digits) { + return Error(errorOrgNoLength) + } + if (orgNoIs9Digits && !isValidOrgNumber(value)) { + return Error(errorOrgNo) + } } }, - [errorOrgNo] + [errorOrgNo, errorOrgNoLength] ) const { diff --git a/packages/dnb-eufemia/src/extensions/forms/Field/OrganizationNumber/__tests__/OrganizationNumber.test.tsx b/packages/dnb-eufemia/src/extensions/forms/Field/OrganizationNumber/__tests__/OrganizationNumber.test.tsx index c5adf387720..1b9613b0598 100644 --- a/packages/dnb-eufemia/src/extensions/forms/Field/OrganizationNumber/__tests__/OrganizationNumber.test.tsx +++ b/packages/dnb-eufemia/src/extensions/forms/Field/OrganizationNumber/__tests__/OrganizationNumber.test.tsx @@ -171,7 +171,7 @@ describe('Field.OrganizationNumber', () => { it('should validate organization number based on the internal validator', async () => { render( - + ) @@ -290,6 +290,7 @@ describe('Field.OrganizationNumber', () => { validateInitially validate={false} validator={customValidator} + onBlurValidator={false} /> ) @@ -326,6 +327,7 @@ describe('Field.OrganizationNumber', () => { validateInitially validate={false} validator={customValidator} + onBlurValidator={false} /> ) @@ -355,7 +357,8 @@ describe('Field.OrganizationNumber', () => { '148623902', ] - const invalidOrgNum = ['123', '123456789', '148623907', '987654321'] + const invalidOrgNum = ['123456789', '148623907', '987654321'] + const invalidOrgNumTooShort = ['123', '321', '123123', '321321'] it.each(validOrgNum)( 'Valid organization number: %s', @@ -378,11 +381,7 @@ describe('Field.OrganizationNumber', () => { 'Invalid organization number: %s', async (orgNo) => { render( - + ) fireEvent.blur(document.querySelector('input')) @@ -395,6 +394,24 @@ describe('Field.OrganizationNumber', () => { }) } ) + + it.each(invalidOrgNumTooShort)( + 'Invalid organization number: %s', + async (orgNo) => { + render( + + ) + + fireEvent.blur(document.querySelector('input')) + + await waitFor(() => { + expect(screen.queryByRole('alert')).toBeInTheDocument() + expect(screen.queryByRole('alert')).toHaveTextContent( + nb.OrganizationNumber.errorOrgNoLength + ) + }) + } + ) }) describe('should extend validation using custom validator', () => { @@ -415,21 +432,19 @@ describe('Field.OrganizationNumber', () => { '756299263', ] - const invalidOrgNum = ['123', '123456789', '148623907', '987654321'] + const invalidOrgNum = ['123456789', '148623907', '987654321'] + const invalidOrgNumTooShort = ['123', '321', '123123', '321321'] - const firstNumIs1 = (value: string) => - value.substring(0, 1) === '1' - ? { status: 'valid' } - : { status: 'invalid' } + const firstNumIs1Validator = (value: string) => { + if (value.substring(0, 1) !== '1') { + return new Error('My error') + } + } const customValidator: Validator = (value, { validators }) => { const { organizationNumberValidator } = validators - const result = firstNumIs1(value) - if (result.status === 'invalid') { - return new Error('My error') - } - return [organizationNumberValidator] + return [organizationNumberValidator, firstNumIs1Validator] } it.each(validOrgNumStartingWith1)( @@ -440,7 +455,7 @@ describe('Field.OrganizationNumber', () => { ) @@ -460,13 +475,10 @@ describe('Field.OrganizationNumber', () => { ) - fireEvent.blur(document.querySelector('input')) - await waitFor(() => { expect(screen.queryByRole('alert')).toBeInTheDocument() expect(screen.queryByRole('alert')).toHaveTextContent('My error') @@ -481,8 +493,7 @@ describe('Field.OrganizationNumber', () => { ) @@ -496,6 +507,28 @@ describe('Field.OrganizationNumber', () => { }) } ) + + it.each(invalidOrgNumTooShort)( + 'Invalid organization number: %s', + async (orgNo) => { + render( + + ) + + fireEvent.blur(document.querySelector('input')) + + await waitFor(() => { + expect(screen.queryByRole('alert')).toBeInTheDocument() + expect(screen.queryByRole('alert')).toHaveTextContent( + nb.OrganizationNumber.errorOrgNoLength + ) + }) + } + ) }) describe('ARIA', () => { diff --git a/packages/dnb-eufemia/src/extensions/forms/constants/locales/en-GB.ts b/packages/dnb-eufemia/src/extensions/forms/constants/locales/en-GB.ts index f11dacd1276..8897a3a8a4c 100644 --- a/packages/dnb-eufemia/src/extensions/forms/constants/locales/en-GB.ts +++ b/packages/dnb-eufemia/src/extensions/forms/constants/locales/en-GB.ts @@ -119,19 +119,27 @@ export default { label: 'National identity number (11 digits)', errorRequired: 'You must enter a national identity number.', errorFnr: 'Invalid national identity number.', + errorFnrLength: + 'Invalid national identity number. Enter a valid national identity number with 11 digits.', errorDnr: 'Invalid D number.', + errorDnrLength: + 'Invalid D number. Enter a valid d-number with 11 digits.', errorMinimumAgeValidator: 'Must be at least {age} years of age.', + errorMinimumAgeValidatorLength: + 'Invalid birth of date. Enter a valid birth of date (incl. century digit) with 7 digits.', }, OrganizationNumber: { label: 'Organisation number', errorRequired: 'You must enter an organisation number.', - errorOrgNo: 'This is not a valid organisation number.', + errorOrgNo: 'Invalid organisation number.', + errorOrgNoLength: + 'Invalid organisation number. Enter a valid organisation number with 9 digits.', }, BankAccountNumber: { label: 'Bank account', errorRequired: 'Enter a valid account number. Account number is mandatory to fill out.', - errorPattern: 'This is not a valid bank account number.', + errorPattern: 'Invalid bank account number.', }, PhoneNumber: { label: 'Mobile number', diff --git a/packages/dnb-eufemia/src/extensions/forms/constants/locales/en-US.ts b/packages/dnb-eufemia/src/extensions/forms/constants/locales/en-US.ts index 93df207562a..66693af762f 100644 --- a/packages/dnb-eufemia/src/extensions/forms/constants/locales/en-US.ts +++ b/packages/dnb-eufemia/src/extensions/forms/constants/locales/en-US.ts @@ -8,7 +8,9 @@ export default { OrganizationNumber: { label: 'Organization number', errorRequired: 'You must enter an organization number.', - errorOrgNo: 'This is not a valid organization number.', + errorOrgNo: 'Invalid organization number.', + errorOrgNoLength: + 'Invalid organization number. Enter a valid organization number with 9 digits.', }, }, } diff --git a/packages/dnb-eufemia/src/extensions/forms/constants/locales/nb-NO.ts b/packages/dnb-eufemia/src/extensions/forms/constants/locales/nb-NO.ts index e37d5d82b2d..8ce5c3920ec 100644 --- a/packages/dnb-eufemia/src/extensions/forms/constants/locales/nb-NO.ts +++ b/packages/dnb-eufemia/src/extensions/forms/constants/locales/nb-NO.ts @@ -117,19 +117,27 @@ export default { label: 'Fødselsnummer (11 siffer)', errorRequired: 'Du må fylle inn et fødselsnummer.', errorFnr: 'Ugyldig fødselsnummer.', + errorFnrLength: + 'Ugyldig fødselsnummer. Skriv inn et gyldig fødselsnummer med 11 siffer.', errorDnr: 'Ugyldig d-nummer.', + errorDnrLength: + 'Ugyldig d-nummer. Skriv inn et gyldig d-nummer med 11 siffer.', errorMinimumAgeValidator: 'Må være minst {age} år.', + errorMinimumAgeValidatorLength: + 'Ugyldig fødselsdato. Skriv inn en gyldig fødselsdato (inkl. århundresiffer) med 7 siffer.', }, OrganizationNumber: { label: 'Organisasjonsnummer', errorRequired: 'Du må fylle inn et organisasjonsnummer.', - errorOrgNo: 'Dette er ikke et gyldig organisasjonsnummer.', + errorOrgNo: 'Ugyldig organisasjonsnummer.', + errorOrgNoLength: + 'Ugyldig organisasjonsnummer. Skriv inn et gyldig organisasjonsnummer med 9 siffer.', }, BankAccountNumber: { label: 'Bankkonto', errorRequired: 'Skriv inn et gyldig kontonummer. Kontonummeret må fylles ut.', - errorPattern: 'Dette er ikke et gyldig kontonummer.', + errorPattern: 'Ugyldig kontonummer.', }, PhoneNumber: { label: 'Mobilnummer',