From b826ee3c8fa9025cc02240199388861e7d3af55b Mon Sep 17 00:00:00 2001 From: dankito Date: Tue, 27 Aug 2024 09:47:13 +0200 Subject: [PATCH] Added comment why dates like 30th of February may occur --- .../codinux/banking/fints/transactions/mt940/Mt940Parser.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/mt940/Mt940Parser.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/mt940/Mt940Parser.kt index 490edb8d..6cc69d2c 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/mt940/Mt940Parser.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/transactions/mt940/Mt940Parser.kt @@ -463,7 +463,10 @@ open class Mt940Parser( year -= 100 } - if (month == 2 && (day > 29 || (day > 28 && year % 4 != 0))) { + // ah, here we go, banks (in Germany) calculate with 30 days each month, so yes, it can happen that dates + // like 30th of February or 29th of February in non-leap years occur, see: + // https://de.m.wikipedia.org/wiki/30._Februar#30._Februar_in_der_Zinsberechnung + if (month == 2 && (day > 29 || (day > 28 && year % 4 != 0))) { // fix that for banks each month has 30 days return LocalDate(year, 3, 1) }