Skip to content

Commit 7457cc6

Browse files
jareystaabm
authored andcommitted
Additional: Fixed validation for specific case for Spanish NIFs. (jquery-validation#1914)
1 parent 662c889 commit 7457cc6

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/additional/nifES.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $.validator.addMethod( "nifES", function( value ) {
1818

1919
// Test specials NIF (starts with K, L or M)
2020
if ( /^[KLM]{1}/.test( value ) ) {
21-
return ( value[ 8 ] === String.fromCharCode( 64 ) );
21+
return ( value[ 8 ] === "TRWAGMYFPDXBNJZSQVHLCKE".charAt( value.substring( 8, 1 ) % 23 ) );
2222
}
2323

2424
return false;

test/methods.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,7 @@ QUnit.test( "nifES", function( assert ) {
13161316
assert.ok( method( "15762034L" ), "NIF valid" );
13171317
assert.ok( method( "05122654W" ), "NIF valid" );
13181318
assert.ok( method( "05122654w" ), "NIF valid: lower case" );
1319+
assert.ok( method( "M1503708Z" ), "NIF valid. Temporary foreign nif" );
13191320
assert.ok( !method( "1144105R" ), "NIF invalid: less than 8 digits without zero" );
13201321
assert.ok( !method( "11441059 R" ), "NIF invalid: white space" );
13211322
assert.ok( !method( "11441059" ), "NIF invalid: no letter" );

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy