Lewati ke konten

NIP

19700503Tanggal lahir
3 Mei 1970
200108TMT CPNS
Agustus 2001
2Jenis kelamin
Perempuan
168Nomor urut

Strukturnya benar

NIP 18 digit punya dua susunan:

Jenis Susunan Dasar
pns Tanggal lahir YYYYMMDD, TMT YYYYMM, digit jenis kelamin, nomor urut 3 digit Perka BKN 22/2007
pppk Tanggal lahir YYYYMMDD, tahun pengangkatan YYYY, perjanjian kerja ke- mulai 21, digit jenis kelamin, nomor urut Peraturan BKN 1/2019
Go TypeScript Hasil
nip.Valid(s) nip.isValid(s) Apakah s NIP yang strukturnya benar
nip.Parse(s) nip.parse(s) Field di bawah
nip.Format(s) nip.format(s) 19881227 200809 2 553
nip.Mask(s) nip.mask(s) Hanya 4 digit terakhir terlihat

Pemisah yang diterima: spasi, ., dan -.

Field (JSON) Contoh Catatan
nip 18 digit
kind pns pns atau pppk
birthDate 1988-12-27
appointmentDate 2008-09 YYYY-MM untuk PNS, YYYY untuk PPPK
sex female Digit 1 laki-laki, 2 perempuan
serial 553
agreement 1 Hanya PPPK: perjanjian kerja ke berapa (21 = pertama)

length, charset, date, sex, serial.

package main
import (
"fmt"
"github.com/haikalmumtaz233/nusaindex/nip"
)
func main() {
fmt.Println(nip.Valid("198812272008092553"))
civil, err := nip.Parse("198812272008092553")
if err == nil {
fmt.Println(civil.Kind, civil.BirthDate, civil.AppointmentDate, civil.Sex)
}
contract, err := nip.Parse("199005172021212541")
if err == nil {
fmt.Println(contract.Kind, contract.AppointmentDate, contract.Agreement)
}
formatted, err := nip.Format("198812272008092553")
if err == nil {
fmt.Println(formatted)
}
fmt.Println(nip.Mask("198812272008092553"))
}
Keluaran
true
pns 1988-12-27 2008-09 female
pppk 2021 1
19881227 200809 2 553
**************2553