- enabled codice fiscale always;

- updated cf validation;
This commit is contained in:
Vitalii Kiiko
2024-12-06 12:07:06 +01:00
parent f2b16cd386
commit a36bb3fcaf
2 changed files with 9 additions and 3 deletions

View File

@@ -4,6 +4,7 @@ import CodiceFiscale from 'codice-fiscale-js';
export const isPIVA = (v) => {
const regexp = new RegExp(/^[0-9]{11}$/);
//console.log('isPIVA', !isEmpty(match(regexp, String(v))))
return !isEmpty(match(regexp, String(v)));
}
@@ -11,6 +12,7 @@ export const isPIVA = (v) => {
export const isCodiceFiscale = (v) => {
//const regexp = new RegExp(/^(?:[A-Z][AEIOU][AEIOUX]|[AEIOU]X{2}|[B-DF-HJ-NP-TV-Z]{2}[A-Z]){2}(?:[\dLMNP-V]{2}(?:[A-EHLMPR-T](?:[04LQ][1-9MNP-V]|[15MR][\dLMNP-V]|[26NS][0-8LMNP-U])|[DHPS][37PT][0L]|[ACELMRT][37PT][01LM]|[AC-EHLMPR-T][26NS][9V])|(?:[02468LNQSU][048LQU]|[13579MPRTV][26NS])B[26NS][9V])(?:[A-MZ][1-9MNP-V][\dLMNP-V]{2}|[A-M][0L](?:[1-9MNP-V][\dLMNP-V]|[0L][1-9MNP-V]))[A-Z]$/, 'i')
//return !isEmpty(match(regexp, v));
//console.log('isCodiceFiscale', CodiceFiscale.check(v))
return CodiceFiscale.check(v);
}