Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/isIdentityCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const validators = {
return false;
}

if (!str.match(/^\d{6}[\-A\+]\d{3}[0-9ABCDEFHJKLMNPRSTUVWXY]{1}$/)) {
if (!str.match(/^\d{6}[\-+A-FU-Y]\d{3}[0-9ABCDEFHJKLMNPRSTUVWXY]{1}$/)) {
return false;
}

Expand Down
9 changes: 7 additions & 2 deletions src/lib/isTaxID.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,12 +501,17 @@ function etEeCheck(tin) {
function fiFiCheck(tin) {
// Extract year and add century
let full_year = tin.slice(4, 6);
const century_symbol = tin.slice(6, 7);
const century_symbol = tin.slice(6, 7).toUpperCase();
switch (century_symbol) {
case '+':
full_year = `18${full_year}`;
break;
case '-':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
full_year = `19${full_year}`;
break;
default:
Expand Down Expand Up @@ -1198,7 +1203,7 @@ const taxIdFormat = {
'es-AR': /(20|23|24|27|30|33|34)[0-9]{8}[0-9]/,
'es-ES': /^(\d{0,8}|[XYZKLM]\d{7})[A-HJ-NP-TV-Z]$/i,
'et-EE': /^[1-6]\d{6}(00[1-9]|0[1-9][0-9]|[1-6][0-9]{2}|70[0-9]|710)\d$/,
'fi-FI': /^\d{6}[-+A]\d{3}[0-9A-FHJ-NPR-Y]$/i,
'fi-FI': /^\d{6}[-+A-FU-Y]\d{3}[0-9A-FHJ-NPR-Y]$/i,
'fr-BE': /^\d{11}$/,
'fr-FR': /^[0-3]\d{12}$|^[0-3]\d\s\d{2}(\s\d{3}){3}$/, // Conforms both to official spec and provided example
'fr-LU': /^\d{13}$/,
Expand Down
11 changes: 9 additions & 2 deletions test/validators.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6834,11 +6834,14 @@ describe('Validators', () => {
'131052A308T', // People born in 2000s
'131052+308T', // People born in 1800s
'131052-313Y',
'010594Y9021', // New century signs since 2023
'020502E902X',
],
invalid: [
'131052308T',
'131052-308T ',
'131052-308A',
'131052G308T',
],
},
{
Expand Down Expand Up @@ -13982,13 +13985,17 @@ describe('Validators', () => {
valid: [
'131052-308T',
'131002+308W',
'131019A3089'],
'131019A3089',
'010594Y9021',
'020502E902X',
'290200A1239'],
invalid: [
'131052308T',
'131052-308TT',
'131052S308T',
'13 1052-308/T',
'290219A1111'],
'290219A1111',
'290200Y1239'],
});
test({
validator: 'isTaxID',
Expand Down
Loading