Skip to content

Commit

Permalink
Ensure serial is not 000
Browse files Browse the repository at this point in the history
  • Loading branch information
frozzare committed Jun 18, 2020
1 parent 29bb4c6 commit 22a84f8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions personnummer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit 22a84f8

Please sign in to comment.