Skip to content

Commit

Permalink
Trenger ikke navfaker lenger - skal ikke utlede fødselsdato fra ident… (
Browse files Browse the repository at this point in the history
  • Loading branch information
charliemidtlyng authored Jan 6, 2025
1 parent d6b1bc7 commit efdfafa
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 30 deletions.
14 changes: 0 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 1 addition & 5 deletions src/components/gruppe/IdentEllerFødselsdatoGruppe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -39,10 +39,6 @@ const IdentEllerFødselsdatoGruppe: FC<Props> = ({

const feilmelding: string = hentTekst('person.feilmelding.ident', intl);

const identErGyldig = (ident: string): boolean =>
fnrValidator(ident).status === 'valid' ||
dnrValidator(ident).status === 'valid';

return (
<>
<KomponentGruppe>
Expand Down
8 changes: 1 addition & 7 deletions src/helpers/steg/barn.ts
Original file line number Diff line number Diff line change
@@ -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 = (
Expand All @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/steg/barnetsBostedEndre.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/utils/validering/validering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down

0 comments on commit efdfafa

Please sign in to comment.