Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2026-09-26 Sasha Mitchell <sash.t.mitchell@gmail.com>
* Czech and Slovak account numbers must be divisible by 11

2026-04-10 Saša Jovanić <sasa@simplify.ba>
* Version 4.5.4

Expand Down
12 changes: 4 additions & 8 deletions src/ibantools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -760,24 +760,20 @@ const checkCroatianBBAN = (bban: string): boolean => {
const checkCzechAndSlovakBBAN = (bban: string): boolean => {
const weightsPrefix = [10, 5, 8, 4, 2, 1];
const weightsSuffix = [6, 3, 7, 9, 10, 5, 8, 4, 2, 1];
const controlPrefix = parseInt(bban.charAt(9), 10);
const controlSuffix = parseInt(bban.charAt(19), 10);
const prefix = bban.substring(4, 9);
const suffix = bban.substring(10, 19);
const prefix = bban.substring(4, 10);
const suffix = bban.substring(10, 20);
let sum = 0;
for (let index = 0; index < prefix.length; index++) {
sum += parseInt(prefix.charAt(index), 10) * weightsPrefix[index];
}
let remainder = sum % 11;
if (controlPrefix !== (remainder === 0 ? 0 : remainder === 1 ? 1 : 11 - remainder)) {
if (sum % 11 !== 0) {
return false;
}
sum = 0;
for (let index = 0; index < suffix.length; index++) {
sum += parseInt(suffix.charAt(index), 10) * weightsSuffix[index];
}
remainder = sum % 11;
return controlSuffix === (remainder === 0 ? 0 : remainder === 1 ? 1 : 11 - remainder);
return sum % 11 === 0;
};

/**
Expand Down
3 changes: 3 additions & 0 deletions test/ibantools_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ describe('IBANTools', function() {
it('with invalid CZ IBAN should return false', function() {
return expect(iban.isValidIBAN('CZ6508000000182000145399')).to.be.false;
});
it('with a Czech IBAN whose prefix is not divisible by 11 should return false', function() {
return expect(iban.isValidIBAN('CZ8008000000612000145399')).to.be.false;
});
it('with valid EE IBAN should return true', function() {
return expect(iban.isValidIBAN('EE443300338400100007')).to.be.true;
});
Expand Down