View Source Nip.Pppk (indonesian_id v1.1.0)
Functions for working with NIP PPPK (Pegawai Pemerintah dengan Perjanjian Kerja)
NIP PPPK consists of 18 digits divided into 6 parts:
8
digits for birth date (YYYYMMDD
)4
digits for TMT (Tanggal Mulai Tugas) (YYYY
)1
digit that indicates the code for PPPK (2
)1
digit for frequency (1-9
)1
digit for sex code (1
for male and2
for female)3
digits for serial number (001-999
)
Summary
Types
Functions
@spec parse(String.t()) :: nip_result()
Parse NIP PPPK into a struct.
This function returns {:ok, %Nip.Pppk{}}
if the NIP is valid, otherwise {:error, reason}
.
Examples
iex> Nip.Pppk.parse("200012312024211001")
{:ok,
%Nip.Pppk{
nip: "200012312024211001",
birth_date: ~D[2000-12-31],
tmt_date: ~D[2024-01-01],
frequency: 1,
sex: "M",
serial_number: "001"
}}
@spec validate_format(String.t()) :: validated_nip_result()
Validate NIP format.
This function returns {:ok, nip}
if the NIP is valid, otherwise {:error, reason}
.
Examples
iex> Nip.Pppk.validate_format("200012312024211001")
{:ok, "200012312024211001"}