personnummer v0.2.0 Personnummer

A module to make the usage of Swedish social security numbers easier.

Link to this section Summary

Functions

Converts a number to a gender. This is the last digit in a personnummer before the luhn check digit

Parses a swedish social security number

Validate Swedish social security number.

Examples

iex> Personnummer.valid?(6403273813)
true
iex> Personnummer.valid?("19130401+2931")
true

Link to this section Functions

Link to this function number_to_gender(number)

Converts a number to a gender. This is the last digit in a personnummer before the luhn check digit.

Examples

iex> Personnummer.number_to_gender(4)
:female
iex> Personnummer.number_to_gender(5)
:male

Parses a swedish social security number

Examples

iex> Personnummer.parse(“510818-9167”) {:ok, %{ check: 7, day: 18, gender: :female, month: 8, number: 916, seperator: “-“, year: 51 }}

Validate Swedish social security number.

Examples

iex> Personnummer.valid?(6403273813)
true
iex> Personnummer.valid?("19130401+2931")
true