From 807d44cb085c6d8e734664223a6dcf469395e22a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Skarp=C3=A5s?= Date: Thu, 11 Apr 2024 10:02:53 +0200 Subject: [PATCH] F - Legger inn vurdering av alder, under eller over --- .../no/nav/eessi/pensjon/shared/person/Fodselsnummer.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/no/nav/eessi/pensjon/shared/person/Fodselsnummer.kt b/src/main/kotlin/no/nav/eessi/pensjon/shared/person/Fodselsnummer.kt index 3d366e03..fe1458a4 100644 --- a/src/main/kotlin/no/nav/eessi/pensjon/shared/person/Fodselsnummer.kt +++ b/src/main/kotlin/no/nav/eessi/pensjon/shared/person/Fodselsnummer.kt @@ -4,9 +4,9 @@ import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonValue import no.nav.eessi.pensjon.shared.person.Fodselsnummer.Companion.tabeller.kontrollsiffer1 import no.nav.eessi.pensjon.shared.person.Fodselsnummer.Companion.tabeller.kontrollsiffer2 -import org.slf4j.LoggerFactory import java.time.LocalDate import java.time.temporal.ChronoUnit +import org.slf4j.LoggerFactory /** * Norwegian national identity number @@ -31,6 +31,8 @@ class Fodselsnummer private constructor(@JsonValue val value: String) { val resultAge = ChronoUnit.YEARS.between(foedselsdato, LocalDate.now()).toInt() return resultAge < 18 } + fun erOverAlder(alder: Int): Boolean = getAge() < alder + fun erUnderAlder(alder: Int): Boolean = getAge() > alder fun isDNumber() = erDnummer fun getBirthDateAsIso() = foedselsdato.toString()