File tree Expand file tree Collapse file tree 2 files changed +2
-1
lines changed Expand file tree Collapse file tree 2 files changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ $.validator.addMethod( "nifES", function( value ) {
18
18
19
19
// Test specials NIF (starts with K, L or M)
20
20
if ( / ^ [ K L M ] { 1 } / . test ( value ) ) {
21
- return ( value [ 8 ] === String . fromCharCode ( 64 ) ) ;
21
+ return ( value [ 8 ] === "TRWAGMYFPDXBNJZSQVHLCKE" . charAt ( value . substring ( 8 , 1 ) % 23 ) ) ;
22
22
}
23
23
24
24
return false ;
Original file line number Diff line number Diff line change @@ -1316,6 +1316,7 @@ QUnit.test( "nifES", function( assert ) {
1316
1316
assert . ok ( method ( "15762034L" ) , "NIF valid" ) ;
1317
1317
assert . ok ( method ( "05122654W" ) , "NIF valid" ) ;
1318
1318
assert . ok ( method ( "05122654w" ) , "NIF valid: lower case" ) ;
1319
+ assert . ok ( method ( "M1503708Z" ) , "NIF valid. Temporary foreign nif" ) ;
1319
1320
assert . ok ( ! method ( "1144105R" ) , "NIF invalid: less than 8 digits without zero" ) ;
1320
1321
assert . ok ( ! method ( "11441059 R" ) , "NIF invalid: white space" ) ;
1321
1322
assert . ok ( ! method ( "11441059" ) , "NIF invalid: no letter" ) ;
You can’t perform that action at this time.
0 commit comments