albertfdp/dni-js

Should "-" be removed?

luixal opened this issue · 1 comments

Hi,

It's great to have this package so I can get rid of some "not as handy" gists.

One thing is, I've always stored DNIs witouth the "-" char between the number and the letter. This is: 12345678Z instead of 12345678-Z.

I don't know for sure which the official format so I made some research and found these:

in both cases, it doesn't include the "-" char in the format (in other cases they show a DNI containing the "-" as invalid) so... I'm thinking the valid format shouldn't include it.

¿Could the "-" be optional in this lib?

Thanks!

After doing some tests, it seems the "-" is optional. If I pass a DNI without it, it gets validated and returned without the "-" char.