jsvat icon indicating copy to clipboard operation
jsvat copied to clipboard

BE: add support for Belgian VAT numbers starting with 1

Open glecam opened this issue 2 years ago • 3 comments

Issue

  • Belgian VAT numbers are composed of the prefix 'BE' followed by the company number of the company. For example: BE0606838532
  • VAT numbers starting with digit 1 do not pass validation, while the official documentation states it can start with either 0 or 1. For example: BE1001686633
  • In the near future the Crossroads Bank for Enterprises in Belgium will start registering companies with a company number starting with digit 1. By 01/01/2023 it is strongly recommended to allow VAT numbers to allow such format.
  • Official communication about this change can be found here.

Suggested fixes in Belgium.ts

  • The regex in the Belgian VAT validator can be changed from ^(BE)(0?\d{9})$ to ^(BE)([0-1]?\d{9})$
  • The following line of code should (imo) be completely removed because the sample VAT number that we received does have 0 as second digit. Otherwise BE1001686633 would be marked as not valid. if (Number(newVat.slice(1, 2)) === 0) return false;
  • A Belgian company number consists of 10 digits. There is a line of code that adds a 0 to the start of the entered VAT if the entered VAT is only 9 characters. But since the start of the company number can be either 0 or 1, this line is not correct. I'm not sure what the best fix is, since this is kind of a breaking change. this const newVat = vat.length === 9 ? '0' + vat : vat;

glecam avatar Jun 14 '22 12:06 glecam

+1

qubis741 avatar Oct 10 '23 07:10 qubis741

+1

zedissime avatar Jan 08 '24 12:01 zedissime

For anyone looking into this issue, someone has forked this abandoned project and added support for the new BE VAT numbers: jsvat-next

ArneAmeye avatar Jan 15 '24 13:01 ArneAmeye