You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The bookingDate can be off by one year if the valuta date (month part) is earlier than the booking date.
The error is located in MT940.php:126
$year = substr($transaction, 0, 2);
$valutaDate = $this->getDate($year . substr($transaction, 2, 4));
$bookingDate = substr($transaction, 6, 4);
if (preg_match('/^\d{4}$/', $bookingDate)) {
// if valuta date is earlier than booking date, then it must be in the new year.$year = substr($transaction, 2, 2) < substr($transaction, 6, 2) ? --$year : $year;
$bookingDate = $this->getDate($year . $bookingDate);
}
The relevant input data to reproduce the error looks like this.
The assumption that the valuta date cant be earlier than the booking date is wrong. (See comment above)
An easy way would be to calculate both dates (same year and previous year) and take the date with the least difference to the valuta date.
I don't know whether this solution has some other drawbacks.
The text was updated successfully, but these errors were encountered:
The bookingDate can be off by one year if the valuta date (month part) is earlier than the booking date.
The error is located in MT940.php:126
The relevant input data to reproduce the error looks like this.
The assumption that the valuta date cant be earlier than the booking date is wrong. (See comment above)
An easy way would be to calculate both dates (same year and previous year) and take the date with the least difference to the valuta date.
I don't know whether this solution has some other drawbacks.
The text was updated successfully, but these errors were encountered: