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 #5

Closed
mattickx opened this issue Oct 26, 2023 · 5 comments
Closed

Belgium vat validation issue #5

mattickx opened this issue Oct 26, 2023 · 5 comments
Labels
question Further information is requested

Comments

@mattickx
Copy link
Owner

mattickx commented Oct 26, 2023

See parent/forked repo: se-panfilov/jsvat#104

I ask to the community, is this something we want ?

@mattickx mattickx added the question Further information is requested label Oct 26, 2023
@pere-pleo
Copy link

pere-pleo commented Oct 30, 2023

Is the question if we want the BE VAT input validation without the 0 to fail or if we want the validation to pass but somehow signal that the initial input was invalid? Asking because the latter was suggested here.

@mattickx
Copy link
Owner Author

mattickx commented Oct 30, 2023

Is the question if we want the BE VAT input validation without the 0 to fail or if we want the validation to pass but somehow signal that the initial input was invalid?

I'm also wondering if Belgium is the only country we change such input?

I would suggest having strict validation in any case, without changing the input value.

So validating based on formats:
BE0 + 9 numbers
OR
BE1 + 9 numbers

Regex would be: /^(BE)([0-1]{1}\d{9})$/

Making the following valid:
BE0838713666
BE0838713666
BE1838713666

And making the following invalid:
0838713666
0838713666
1838713666

And we leave it to the developers to add it before validating if they would like to validate only numbers of vat:
For example: checkVat('BE' + userInput, ...)

This would also mean we don't need to change the input nor alert that an input has changed.
But I'm open for discussing this, what is your current use-case?

@mattickx
Copy link
Owner Author

mattickx commented Nov 14, 2023

Like previously mentioned, I've changed Belgium such that the format becomes:
BE + Prefix (0 or 1) + 9 numbers

"BE" prefix currently needs to be present, but can be changed if that is a use case that is needed.
I've added 3 lines for this in commentary with the notice: "BE: Optional Country Code".

Validating without BE could be achieved by: checkVat('BE' + userInput, ...)

@satblip
Copy link

satblip commented Nov 20, 2023

A Belgian company number without BE is indeed a valid KBO number (local company registry), but not a correct VAT number that will need the prefix to be present

@mattickx
Copy link
Owner Author

I'm closing this issue for now, feel free to comment if the community has other concerns about this specific case

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

No branches or pull requests

3 participants