Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Belgium vat validation issue #104

Open
Pouch opened this issue Apr 28, 2020 · 2 comments
Open

Belgium vat validation issue #104

Pouch opened this issue Apr 28, 2020 · 2 comments
Assignees
Labels

Comments

@Pouch
Copy link

Pouch commented Apr 28, 2020

There is an issue with the vat validation for Belgium.
Actually, vat format is BE0 + 9 numbers.

Using your validator with the example :
checkVAT('BE0411905847', [belgium]); // true: accept only Belgium VATs
is working but the issue is with this format (without the zero)
checkVAT('BE411905847', [belgium]); // return true but should be false

@wilgert wilgert added the bug label Apr 28, 2020
@wilgert wilgert self-assigned this May 4, 2020
@wilgert
Copy link
Collaborator

wilgert commented May 4, 2020

The code currently prepends the zero to the vat if it is missing:

const newVat = vat.length === 9 ? '0' + vat : vat;

Is that wrong?

@Pouch
Copy link
Author

Pouch commented May 4, 2020

Ok that explains why the validator returns true.

Actually, depending on the user's input, the validator is updating it to fit the country's rule. But it implies that the developer must know all formating rules for all countries because the validator will transforms it before validating step.
I don't know if it was a request from developers or from you to implement it but is there a way to get a field saying that "the initial input was modified before passing the validation" ?

Because both isValid & isValidFormat fields return true in the actual implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants