Skip to content

Commit

Permalink
fix(isTaxID): fix el-GR locale when checksum is 10 (#1529)
Browse files Browse the repository at this point in the history
Add correct tax identifier to demonstrate issue and fix.

Thanks to: Panos Papadopoulos
  • Loading branch information
dspinellis authored Dec 17, 2020
1 parent edcd161 commit 8831db3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/isTaxID.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ function elGrCheck(tin) {
for (let i = 0; i < 8; i++) {
checksum += digits[i] * (2 ** (8 - i));
}
return checksum % 11 === digits[8];
return ((checksum % 11) % 10) === digits[8];
}

/*
Expand Down
1 change: 1 addition & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -9615,6 +9615,7 @@ describe('Validators', () => {
args: ['el-GR'],
valid: [
'758426713',
'032792320',
'054100004'],
invalid: [
'054100005',
Expand Down

0 comments on commit 8831db3

Please sign in to comment.