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}
Types
date_tuple :: {pos_integer, pos_integer, pos_integer}
Tuple with {Year, Month, Day}
Functions
Specs
get_birthdate(String.t) :: date_tuple
Get the birthday from kennitala
iex> Kennitala.get_birthdate("0102031129")
{1903, 2, 1}
Specs
type(String.t) :: :individual | :corporate
Get the type of kennitala.
iex> Kennitala.type("1111111119")
:individual
Specs
valid?(String.t) :: boolean
Check legality of kennitala
iex> Kennitala.valid?("1111111119")
true