Skip to content

Commit

Permalink
F - Legger inn vurdering av alder, under eller over
Browse files Browse the repository at this point in the history
  • Loading branch information
dskarpas committed Apr 11, 2024
1 parent f931865 commit 807d44c
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()

Expand Down

0 comments on commit 807d44c

Please sign in to comment.