View Source Nik (indonesian_id v1.1.0)
Functions for working with NIK (Nomor Induk Kependudukan)
NIK consists of 16 digits that divided into 7 parts:
2
digits for Province Code (11-92
)2
digits for City Code (01-99
)2
digits for Subdistrict Code (01-99
)2
digits for Birth Day (01-31
), if the person is female, the date will be added by40
2
digits for Birth Month (01-12
)2
digits for Birth Year (YY
)4
digits for serial number (0001-9999
) that is determined by system
Summary
Functions
Parse NIK into a struct.
Types
Functions
Parse NIK into a struct.
Returns {:ok, %Nik{}}
if the NIK is valid, otherwise {:error, reason}
.
Examples
iex> Nik.parse("7210142507971234")
{:ok,
%Nik{
id: "7210142507971234",
area: %{
city: %{"code" => "10", "name" => "Sigi", "type" => "Kabupaten"},
district: %{"code" => "14", "name" => "Marawola", "type" => "Kecamatan"},
province: %{"code" => "72", "name" => "Sulawesi Tengah"}
},
birth_date: ~D[1997-07-25],
sex: "M",
serial_number: "1234"
}}