stdnum-js icon indicating copy to clipboard operation
stdnum-js copied to clipboard

Spanish DNI for children and citizens who live outside of Spain

Open teebu opened this issue 2 years ago • 4 comments

Based on this document, there are 2 additional formats allowed for DNI with a designated special latter.

I used these sites as refferences: https://www.strongabogados.com/tax-id-spain.php https://docedit.supernaeyeglass.com/articles/#!eyeglass-administration-guides-publication/content-classification-feature-guide/a/h3__54668704 https://www.esma.europa.eu/sites/default/files/library/esma70-1861941480-56_qas_mifir_data_reporting.pdf

DNI (Documento Nacional de Identidad): This is the ID number for Spanish citizens. The DNI format is 8 digits followed by a letter (example: 12345678A). The same number is used for one's driver's license.

There are two other classes of DNI for citizens of Spain: 'K' (example: K12345678A) for children under 14 who are Spanish residents. 'L' (example: L12345678A) for Spanish citizens who live outside Spain.

teebu avatar May 30 '23 22:05 teebu

Looks like it's 7 digits in there.

https://www.oecd.org/tax/automatic-exchange/crs-implementation-and-assistance/tax-identification-numbers/SPAIN-TIN.pdf

koblas avatar Jun 02 '23 19:06 koblas

Though they're not referenced on the offical documents.

https://www.interior.gob.es/opencms/ca/servicios-al-ciudadano/tramites-y-gestiones/dni/calculo-del-digito-de-control-del-nif-nie/

koblas avatar Jun 02 '23 20:06 koblas

I've dug around a lot and I cannot find any validation algorithms for the "KLM" code set. I've got two choices:

  1. Just allow them without checksum validation
  2. Wait until some test cases are available

Do you currently have some that you're trying to validate?

koblas avatar Jun 02 '23 20:06 koblas

No, I dont have any. This is just something I encountered in my research.

Im not clear on the approach. You seem to have done something similar in the other validators.

You did something similar here for NIF https://github.com/koblas/stdnum-js/blob/main/src/es/nif.ts#L65 ?

This site makes it seem like they are just indicators and not part of the checksum? https://www.strongabogados.com/tax-id-spain.php like K12345678A is the same as 12345678A?

Do you think its safe to ignore KL if its present for DNI when validating?

Also here: https://docedit.supernaeyeglass.com/articles/#!eyeglass-administration-guides-publication/content-classification-feature-guide/a/h4_250181372 image

teebu avatar Jun 05 '23 15:06 teebu