be-nrn
Belgian NRN (National Registry Number) utility functions.
Quick start
npm install be-nrn
; ; // => 32 (at time of writing)
API
NOTE: All NRN input strings are normalized
getAge(nrn: string, options): number
Get the age of a citizen's NRN.
; // => 32 (at time of writing)
Age calculation is based on midnight in the Brussels timezone, regardless of the timezone in which the code is run.
options
comparisonDate: Date
– get the age on a specific date
getBirthDate(nrn: string): Date
Get the birth date of a citizen's NRN.
; // => 1986-08-13T22:00:00.000Z
The birth date's time is set to midnight in the Brussels timezone, regardless of the timezone in which the code is run.
isBiologicalFemale(nrn: string): boolean
Determine if the biological birth gender of a citizen's NRN is female.
; // => true
isBiologicalMale(nrn: string): boolean
Determine if the biological birth gender of a citizen's NRN is male.
; // => true
isBirthDateKnown(nrn: string): boolean
Determine if the birthdate is known. Is is possible (eg. for migrated people) to have an unknown date of birth.
; // => true; // => false
isBisNumber(nrn: string): boolean
Determine if an NRN number is also a BIS number.
; // => false; // => true
isEqual(nrn1: string, nrn2: string): boolean
Compare two NRN's for equality.
; // => true
isGenderKnown(nrn: string): boolean
Determine if the gender is known. Is is possible (eg. for migrated people) to have an unknown gender.
; // => true; // => false; // => true
isLegalAdult(nrn: string): boolean
Determine if a citizen is legal adult.
; // => true
normalize(nrn: string): string
Used internally for normalizing nrn strings. All we do is remove non-numeric characters.
; // => 86081400084; // => 86081400084
parse(nrn: string): Nrn
Used internally for parsing nrn strings. The resulting object can be used as input for all other functions.
;// => { birthDate: '860814', serial: '000', checksum: '84' }