From efdfafa52456e55ac825ba426b123b18eb8b4a90 Mon Sep 17 00:00:00 2001 From: Charlie Midtlyng Date: Mon, 6 Jan 2025 16:04:31 +0100 Subject: [PATCH] =?UTF-8?q?Trenger=20ikke=20navfaker=20lenger=20-=20skal?= =?UTF-8?q?=20ikke=20utlede=20f=C3=B8dselsdato=20fra=20ident=E2=80=A6=20(#?= =?UTF-8?q?1820)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 14 -------------- package.json | 1 - .../gruppe/IdentEllerF\303\270dselsdatoGruppe.tsx" | 6 +----- src/helpers/steg/barn.ts | 8 +------- src/helpers/steg/barnetsBostedEndre.ts | 4 ++-- src/utils/validering/validering.ts | 2 +- 6 files changed, 5 insertions(+), 30 deletions(-) diff --git a/package-lock.json b/package-lock.json index 905b51298..d8227c262 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,6 @@ "form-data": "^4.0.1", "html-react-parser": "^5.2.2", "iso-datestring-validator": "^2.2.2", - "nav-faker": "^3.2.4", "react": "^19.0.0", "react-dom": "^19.0.0", "react-dropzone": "^14.3.5", @@ -8997,14 +8996,6 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, - "node_modules/nav-faker": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/nav-faker/-/nav-faker-3.2.4.tgz", - "integrity": "sha512-XnpyF0iPMgDaFToussR8AyRSj1lrnQvsswdeG9tCstR2cqj2FhBO9udKyhXnbuxTbG9lXzGswpVexQhtl0H0Ag==", - "dependencies": { - "seedrandom": "^2.4.3" - } - }, "node_modules/neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", @@ -13149,11 +13140,6 @@ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "dev": true }, - "node_modules/seedrandom": { - "version": "2.4.4", - "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-2.4.4.tgz", - "integrity": "sha512-9A+PDmgm+2du77B5i0Ip2cxOqqHjgNxnBgglxLcX78A2D6c2rTo61z4jnVABpF4cKeDMDG+cmXXvdnqse2VqMA==" - }, "node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", diff --git a/package.json b/package.json index 4cd6520cc..9221ce481 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "form-data": "^4.0.1", "html-react-parser": "^5.2.2", "iso-datestring-validator": "^2.2.2", - "nav-faker": "^3.2.4", "react": "^19.0.0", "react-dom": "^19.0.0", "react-dropzone": "^14.3.5", diff --git "a/src/components/gruppe/IdentEllerF\303\270dselsdatoGruppe.tsx" "b/src/components/gruppe/IdentEllerF\303\270dselsdatoGruppe.tsx" index 7dac939d8..afb270327 100644 --- "a/src/components/gruppe/IdentEllerF\303\270dselsdatoGruppe.tsx" +++ "b/src/components/gruppe/IdentEllerF\303\270dselsdatoGruppe.tsx" @@ -4,9 +4,9 @@ import { hentTekst } from '../../utils/søknad'; import KomponentGruppe from './KomponentGruppe'; import { useLokalIntlContext } from '../../context/LokalIntlContext'; import { Checkbox } from '@navikt/ds-react'; -import { dnr as dnrValidator, fnr as fnrValidator } from '@navikt/fnrvalidator'; import { TextFieldMedBredde } from '../TextFieldMedBredde'; import { DatoBegrensning, Datovelger } from '../dato/Datovelger'; +import { identErGyldig } from '../../utils/validering/validering'; interface Props { identLabel: string; @@ -39,10 +39,6 @@ const IdentEllerFødselsdatoGruppe: FC = ({ const feilmelding: string = hentTekst('person.feilmelding.ident', intl); - const identErGyldig = (ident: string): boolean => - fnrValidator(ident).status === 'valid' || - dnrValidator(ident).status === 'valid'; - return ( <> diff --git a/src/helpers/steg/barn.ts b/src/helpers/steg/barn.ts index b0accce2d..277fbfa00 100644 --- a/src/helpers/steg/barn.ts +++ b/src/helpers/steg/barn.ts @@ -1,10 +1,9 @@ import { hentFeltObjekt, hentTekst } from '../../utils/søknad'; import { differenceInYears } from 'date-fns'; -import { dagensDato, datoTilStreng, strengTilDato } from '../../utils/dato'; +import { dagensDato, strengTilDato } from '../../utils/dato'; import { hentUid } from '../../utils/autentiseringogvalidering/uuid'; import { EBarn, IBarn } from '../../models/steg/barn'; import { ESvar } from '../../models/felles/spørsmålogsvar'; -import navfaker from 'nav-faker'; import { LokalIntlShape } from '../../language/typer'; export const hentNyttBarn = ( @@ -17,11 +16,6 @@ export const hentNyttBarn = ( intl: LokalIntlShape, skalHaBarnepass?: boolean ): IBarn => { - if (!barnDato && ident) { - barnDato = datoTilStreng( - navfaker.personIdentifikator.getFødselsdato(ident) - ); - } return { ident: hentFeltObjekt('person.ident.visning', ident, intl), alder: hentFeltObjekt( diff --git a/src/helpers/steg/barnetsBostedEndre.ts b/src/helpers/steg/barnetsBostedEndre.ts index 161831284..3a746c768 100644 --- a/src/helpers/steg/barnetsBostedEndre.ts +++ b/src/helpers/steg/barnetsBostedEndre.ts @@ -1,4 +1,3 @@ -import { erGyldigFødselsnummer } from 'nav-faker/dist/personidentifikator/helpers/fodselsnummer-utils'; import { erGyldigDato } from '../../utils/dato'; import { IBarn } from '../../models/steg/barn'; import { @@ -12,9 +11,10 @@ import { stringErNullEllerTom, stringHarVerdiOgErIkkeTom, } from '../../utils/typer'; +import { identErGyldig } from '../../utils/validering/validering'; export const erIdentUtfyltOgGyldig = (ident?: string): boolean => - !!ident && erGyldigFødselsnummer(ident); + !!ident && identErGyldig(ident); export const erFødselsdatoUtfyltOgGyldigEllerTomtFelt = ( fødselsdato?: string diff --git a/src/utils/validering/validering.ts b/src/utils/validering/validering.ts index 4cb8594a9..92fca8b35 100644 --- a/src/utils/validering/validering.ts +++ b/src/utils/validering/validering.ts @@ -114,7 +114,7 @@ export const sivilstatusSchema = object({ }).default(undefined), }); -const identErGyldig = (ident: string): boolean => +export const identErGyldig = (ident: string): boolean => fnrValidator(ident).status === 'valid' || dnrValidator(ident).status === 'valid';