Skip to content

Commit

Permalink
fix(psd-bank-pdf): Correct getting the booking year from the statement
Browse files Browse the repository at this point in the history
  • Loading branch information
sschuberth committed Oct 16, 2024
1 parent 65fa052 commit 8b9e378
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions plugins/parsers/psd-bank-pdf/src/main/kotlin/PsdBankPdfParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import java.io.File
import java.text.NumberFormat
import java.text.ParseException
import java.time.LocalDate
import java.time.Month
import java.util.Locale

import kotlin.IllegalArgumentException
Expand Down Expand Up @@ -106,16 +107,10 @@ class PsdBankPdfParser : Logger, Parser() {

with(state) {
val fromDate = checkNotNull(from?.date)
val fromYear = if (fromDate.month == Month.DECEMBER) fromDate.year + 1 else fromDate.year

val postDate = LocalDate.of(fromDate.year, checkNotNull(postMonth), checkNotNull(postDay))
if (postDate < fromDate) {
postDate.plusYears(1)
}

val valueDate = LocalDate.of(fromDate.year, checkNotNull(valueMonth), checkNotNull(valueDay))
if (valueDate < fromDate) {
valueDate.plusYears(1)
}
val postDate = LocalDate.of(fromYear, checkNotNull(postMonth), checkNotNull(postDay))
val valueDate = LocalDate.of(fromYear, checkNotNull(valueMonth), checkNotNull(valueDay))

bookings += BookingItem(
postDate = postDate,
Expand Down

0 comments on commit 8b9e378

Please sign in to comment.