-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dev/fjern-forespoersel-type
- Loading branch information
Showing
23 changed files
with
74 additions
and
389 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
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
30 changes: 1 addition & 29 deletions
30
felles/src/main/kotlin/no/nav/helsearbeidsgiver/felles/domene/Person.kt
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,38 +1,10 @@ | ||
@file:UseSerializers(LocalDateSerializer::class) | ||
|
||
package no.nav.helsearbeidsgiver.felles.domene | ||
|
||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.UseSerializers | ||
import no.nav.helsearbeidsgiver.utils.json.serializer.LocalDateSerializer | ||
import no.nav.helsearbeidsgiver.utils.wrapper.Fnr | ||
import java.time.LocalDate | ||
import java.time.format.DateTimeFormatter | ||
|
||
private val fnrFoedselsdatoFormatter = DateTimeFormatter.ofPattern("ddMMyyyy") | ||
|
||
@Serializable | ||
data class Person( | ||
val fnr: Fnr, | ||
val navn: String, | ||
val foedselsdato: LocalDate, | ||
) { | ||
companion object { | ||
// For info om fødselsdato i fnr, se https://lovdata.no/dokument/SF/forskrift/2017-07-14-1201/KAPITTEL_2#%C2%A72-2-1 | ||
fun foedselsdato(fnr: Fnr): LocalDate { | ||
val foedtEtterAar39 = fnr.verdi[4].digitToInt() >= 4 | ||
val individsifferUnder500 = fnr.verdi[6].digitToInt() < 5 | ||
|
||
val aarhundre = | ||
if (foedtEtterAar39 || individsifferUnder500) { | ||
"19" | ||
} else { | ||
"20" | ||
} | ||
|
||
val foedseldato = fnr.verdi.take(4) + aarhundre + fnr.verdi.slice(4..5) | ||
|
||
return LocalDate.parse(foedseldato, fnrFoedselsdatoFormatter) | ||
} | ||
} | ||
} | ||
) |
Oops, something went wrong.