Fix statement line entry date year based on the statement date #117
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After a bit more than a year I finally managed to re-implement this according to our discussion on PR #83.
This implementation infers the correct year for the entry date of a statement line based on the shortest interval between the entry date's month-day and the statement date. For MT940 the statement date is taken to be the date of the closing balance (
:62F:
or:62M
); for MT942 the statement date is the date-time indicator (:13D:
).After reading the whole statement page, the statement lines are post-processed to adjust the entry dates, because in the case of MT940 the statement date is only available after reading all the statement lines.
Caveat: The entry date is an optional field, but if it is absent the
StatementLine
constructor assumes it to be the same as the value date. In this case the post-processor may choose an incorrect year.Closes #83