-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bytt til tidslinjebibliotek fra familie-felles (#5099)
### 💰 Hva skal gjøres, og hvorfor? Favro: NAV-23270 Fortsettelse av #5089 Bytter ut tidslinje fra ba-sak med tidslinje fra familie-felles enkelte steder. Holder PR'ene små, så de skal være lette å lese. Bør leses commit for commit. Det er noe duplikatkode, men dette vil fjernes i senere PR'er
- Loading branch information
1 parent
68b2f21
commit 4fd53aa
Showing
10 changed files
with
98 additions
and
77 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
21 changes: 21 additions & 0 deletions
21
src/main/kotlin/no/nav/familie/ba/sak/kjerne/tidslinjefamiliefelles/utils/PeriodeUtils.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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package no.nav.familie.ba.sak.kjerne.tidslinjefamiliefelles.utils | ||
|
||
import no.nav.familie.ba.sak.common.førsteDagIInneværendeMåned | ||
import no.nav.familie.ba.sak.common.rangeTo | ||
import no.nav.familie.ba.sak.common.sisteDagIInneværendeMåned | ||
import no.nav.familie.ba.sak.common.toYearMonth | ||
import no.nav.familie.tidslinje.PRAKTISK_TIDLIGSTE_DAG | ||
import no.nav.familie.tidslinje.Periode | ||
import java.time.YearMonth | ||
|
||
fun <V> Periode<V>.splitPerMåned(tilOgMedMåned: YearMonth): List<Periode<V>> { | ||
val førsteMåned = (this.fom ?: PRAKTISK_TIDLIGSTE_DAG).toYearMonth() | ||
val sisteMåned = setOfNotNull(this.tom?.toYearMonth(), tilOgMedMåned).minOrNull()!! | ||
return førsteMåned.rangeTo(sisteMåned).map { | ||
Periode( | ||
verdi = this.verdi, | ||
fom = it.førsteDagIInneværendeMåned(), | ||
tom = it.sisteDagIInneværendeMåned(), | ||
) | ||
} | ||
} |
Oops, something went wrong.