From 22a84f82d8a33e4475d29ebc95a3e3ed97d99878 Mon Sep 17 00:00:00 2001 From: Fredrik Forsmo Date: Thu, 18 Jun 2020 16:27:02 +0200 Subject: [PATCH] Ensure serial is not 000 --- personnummer.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/personnummer.go b/personnummer.go index 8537801..5d89b59 100644 --- a/personnummer.go +++ b/personnummer.go @@ -207,6 +207,10 @@ func (p *Personnummer) parse(pin string) error { break } + if num == "000" { + return errInvalidSecurityNumber + } + length := len(dateBytes) day := charsToDigit(dateBytes[length-2 : length]) month := charsToDigit(dateBytes[length-4 : length-2])