Skip to content

Commit 8b9e378

Browse files
committed
fix(psd-bank-pdf): Correct getting the booking year from the statement
1 parent 65fa052 commit 8b9e378

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

plugins/parsers/psd-bank-pdf/src/main/kotlin/PsdBankPdfParser.kt

+4-9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import java.io.File
1414
import java.text.NumberFormat
1515
import java.text.ParseException
1616
import java.time.LocalDate
17+
import java.time.Month
1718
import java.util.Locale
1819

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

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

110-
val postDate = LocalDate.of(fromDate.year, checkNotNull(postMonth), checkNotNull(postDay))
111-
if (postDate < fromDate) {
112-
postDate.plusYears(1)
113-
}
114-
115-
val valueDate = LocalDate.of(fromDate.year, checkNotNull(valueMonth), checkNotNull(valueDay))
116-
if (valueDate < fromDate) {
117-
valueDate.plusYears(1)
118-
}
112+
val postDate = LocalDate.of(fromYear, checkNotNull(postMonth), checkNotNull(postDay))
113+
val valueDate = LocalDate.of(fromYear, checkNotNull(valueMonth), checkNotNull(valueDay))
119114

120115
bookings += BookingItem(
121116
postDate = postDate,

0 commit comments

Comments
 (0)