View Source Nip.Pns (indonesian_id v1.0.0)
Functions for working with NIP PNS (Nomor Induk Pegawai Negeri Sipil)
NIP PNS consists of 18 digits that divided into 4 parts:
8
digits for birth date (YYYYMMDD
)6
digits for TMT (Tanggal Mulai Tugas) (YYYYMM
)1
digit for sex code (1
for male and2
for female)3
digits for serial number (001-999
)
Summary
Functions
Parse NIP PNS into a struct.
This function returns {:ok, %Nip.Pns{}}
if the NIP is valid, otherwise {:error, reason}
.
Examples
iex> Nip.Pns.parse("200012312024121001")
{:ok,
%Nip.Pns{
nip: "200012312024121001",
birth_date: ~D[2000-12-31],
tmt_date: ~D[2024-12-01],
sex: "M",
serial_number: "001"
}}
Validate NIP format.
This function returns {:ok, nip}
if the NIP is valid, otherwise {:error, reason}
.
Examples
iex> Nip.Pns.validate_format("200012312024121001")
{:ok, "200012312024121001"}