arhs / iban.js

IBAN & BBAN validation, formatting and conversion in Javascript
https://arhs.github.io/iban.js/
MIT License
535 stars 130 forks source link

Valid BBAN is considered invalid #48

Closed abelosorio closed 5 years ago

abelosorio commented 6 years ago

I have a valid BBAN but the method isValidBBAN returns false with it:

iban.toBBAN('CR25010200009074883572');
// '0102 00009074883572'

iban.isValidBBAN('0102 00009074883572');
// false

iban.isValidBBAN(iban.toBBAN('CR25010200009074883572'));
// false
LaurentVB commented 5 years ago

Hello,

Sorry for the super late reply, going through the issues backlog. The correct way to call isValidBBAN is by passing the country code as first parameter (which is not properly documented, I must say). So your code becomes:

iban.isValidBBAN('CR', iban.toBBAN('CR25010200009074883572'));
// true
abelosorio commented 5 years ago

Hi @LaurentVB! It's okay.

I wouldn't close this issue until the documentation is updated, since other people may face it.

Thanks!