Closed RobQuistNL closed 7 years ago
According to the spec There are supposed to be two dates: one is the transaction date the other the 'valuedate'. (the date they use for actual value changes of the amount ... I think)
According to that it would be more 'logical' to keep the year from the first and use it for the second too ? I can imagine that with a transaction starting on 31rst of december the value date might move to 1st of january the next year... ? But that could be checked too... Then again... It could also just differ by one day? (up or down... or maybe even more days... ?) What to do... ?
Yeah that would be a valid case.. I know that this will at least fix 99% of the problems occuring regarding these dates.
I'm not sure where else you could get a year from - using the current year (as is happening now) is definately not right. Maybe contact ABN and ask them what the intention was / is? Its not really clear for me when I look at the spec either..
@RobQuistNL I've pushed a PR to try and fix this issue (#50) If you could check that it works we can merge it! :)
Looks good! Thanks for the quick response there man, appreciate it. Will test this tomorrow!
@RobQuistNL great! Looking forward to the results!
Typical bug cases; we just had a customer that was reading in bank transactions, and the dates were 2017-12-15 instead of 2016-12-15.
The cause was found here; https://github.com/fruitl00p/php-mt940/blob/master/src/Parser/Banking/Mt940/Engine/Abn.php#L87-L94
As you can see in this code, only a month and date seem to be read in. The PHP Date function gets fed "mmdd" instead of "yymmdd" - and it works fine for the biggest part of the year. It will only fail if you're reading in transactions from a different year.
We had some transactions on that were 16-12-15 but got read in as 17-12-15 because the date function got fed "1215".
An example transaction looks like this:
As you can see on this line there's 2 dates - 1 with a year and one without;
:61:161215---1215C109,65N654NONREF
We need to take the year in account or bank imports overlapping different years will break.
I'll be opening a PR for this issue.