Kennitala icon indicating copy to clipboard operation
Kennitala copied to clipboard

Random numbers below 20 are considered valid

Open MiniGod opened this issue 3 years ago • 4 comments

In #6 you confirmed that the 7-8th digit should start at 20, and fixed the generator.

But isPerson returns true for the 7-8th numbers below 20.

For instance 070222-0000 returns true, but is invalid.

MiniGod avatar Jan 31 '22 12:01 MiniGod

I think we discussed this before, the 7-8th numbers start at 20 right now but I think that is a decision by Þjóðskrá, so maybe in the future they decide to start counting at 00 and I'm not sure they will let anyone know.

We could have a min 20 requirement, the advantage would be a stricter validation.

Probably worth it to add this then.

HermannBjorgvin avatar Jan 31 '22 14:01 HermannBjorgvin

Since the generator starts at 20, I think the validator should do the same.

MiniGod avatar Feb 04 '22 12:02 MiniGod

Yeah I think we'll do that, if Þjóðskrá changes the way they generate Kennitölur it will be a huge breaking change anyway so a version bump wouldn't be the worst result in that case. The big advantage is stricter validation. Lets go for it.

I'll have time over the weekend to implement a couple of the fixes for V1 and then I need to publish V2 soon so people can start validating system Id's.

HermannBjorgvin avatar Feb 04 '22 16:02 HermannBjorgvin

This is fixed in V2, there is a beta version available now on the v2.0.0-beta.0 version.

yarn add [email protected]

HermannBjorgvin avatar Apr 06 '22 15:04 HermannBjorgvin