-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3305 from navikt/feature/pensjon-oppdatert-valide…
…ring Feature/pensjon oppdatert validering
- Loading branch information
Showing
7 changed files
with
92 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 10 additions & 3 deletions
13
apps/dolly-frontend/src/main/js/src/components/fagsystem/alderspensjon/form/validation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
import { ifPresent, messages, requiredDate, requiredNumber } from '@/utils/YupValidations' | ||
import * as Yup from 'yup' | ||
import { isAfter } from 'date-fns' | ||
|
||
export const validation = { | ||
alderspensjon: ifPresent( | ||
'$pensjonforvalter.alderspensjon', | ||
Yup.object({ | ||
iverksettelsesdato: requiredDate, | ||
iverksettelsesdato: requiredDate.test( | ||
'er-fremtid', | ||
'Måned må være frem i tid', | ||
function validDate(iverksettelsesdato) { | ||
return isAfter(new Date(iverksettelsesdato), new Date()) | ||
}, | ||
), | ||
uttaksgrad: requiredNumber.typeError(messages.required), | ||
relasjoner: Yup.array().of( | ||
Yup.object({ | ||
sumAvForvArbKapPenInntekt: Yup.number() | ||
.transform((i, j) => (j === '' ? null : i)) | ||
.nullable(), | ||
}) | ||
}), | ||
), | ||
}) | ||
}), | ||
), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters