From a69c89bee424581241b376f5c055a8c113b99534 Mon Sep 17 00:00:00 2001 From: "Faraz S. A." <345765971+FSA-G@users.noreply.github.com> Date: Sun, 29 Nov 2026 19:52:22 +0700 Subject: [PATCH] fix(isVAT): accept the 16-digit Indonesian NPWP Since PMK 112/PMK.03/2022 the NPWP has 16 digits: the NIK for resident individuals, and the old 15-digit number with a leading 0 for other taxpayers. Also escape the dots in the formatted 15-digit pattern, which matched any character. --- src/lib/isVAT.js | 2 +- test/validators.test.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/isVAT.js b/src/lib/isVAT.js index f561d3ae1..0922d39c8 100644 --- a/src/lib/isVAT.js +++ b/src/lib/isVAT.js @@ -89,7 +89,7 @@ export const vatMatchers = { CA: str => /^(CA)?\d{9}$/.test(str), IS: str => /^(IS)?\d{5,6}$/.test(str), IN: str => /^(IN)?\d{15}$/.test(str), - ID: str => /^(ID)?(\d{15}|(\d{2}.\d{3}.\d{3}.\d{1}-\d{3}.\d{3}))$/.test(str), + ID: str => /^(ID)?(\d{15,16}|(\d{2}\.\d{3}\.\d{3}\.\d{1}-\d{3}\.\d{3}))$/.test(str), IL: str => /^(IL)?\d{9}$/.test(str), KZ: str => /^(KZ)?\d{12}$/.test(str), NZ: str => /^(NZ)?\d{9}$/.test(str), diff --git a/test/validators.test.js b/test/validators.test.js index 98d2a12ff..e13448a2c 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -15710,10 +15710,16 @@ describe('Validators', () => { '123456789012345', 'ID12.345.678.9-012.345', '12.345.678.9-012.345', + 'ID0123456789012345', + '0123456789012345', + '3171012345678901', ], invalid: [ 'ID 123456789012345', '12345678901234', + '12345678901234567', + '12a345b678c9-012d345', + '012.345.678.9-012.345', ], }); test({