Kennitala v1.0.0 Kennitala

Elixir library for validating and handling the Icelandic Kennitala national identity number.

Kennitala are 10 digit numbers.

  • 6 digits designate the birthday of a person in a DDMMYY manner. If a Kennitala holder is a corporate entity then 4 is added to the first digit.
  • 2 random digits.
  • 1 verification digit.
  • 1 digit representing the century. 9 for 1900, 0 for 2000.

It’s common to represent the Kennitala with a hyphen after the first 6 digits (ie. 111111-1119) and it is supported by this library.

Summary

Types

Tuple with {Year, Month, Day}

Functions

Get the birthday from kennitala

Get the type of kennitala

Check legality of kennitala

Types

date_tuple :: {pos_integer, pos_integer, pos_integer}

Tuple with {Year, Month, Day}

Functions

get_birthdate(kennitala)

Specs

get_birthdate(String.t) :: date_tuple

Get the birthday from kennitala

iex> Kennitala.get_birthdate("0102031129")
{1903, 2, 1}
type(kennitala)

Specs

type(String.t) :: :individual | :corporate

Get the type of kennitala.

iex> Kennitala.type("1111111119")
:individual
valid?(kennitala)

Specs

valid?(String.t) :: boolean

Check legality of kennitala

iex> Kennitala.valid?("1111111119")
true