Belgian NRN (National Registry Number) utility functions.
npm install be-nrn
import { getAge } from 'be-nrn';
getAge('860814 000 00'); // => 32 (at time of writing)
NOTE: All NRN input strings are normalized
Get the age of a citizen's NRN.
getAge('860814 000 00'); // => 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.
comparisonDate: Date
– get the age on a specific date
Get the birth date of a citizen's NRN.
getBirthDate('860814 000 00'); // => 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.
Determine if the biological birth gender of a citizen's NRN is female.
isBiologicalFemale('860814 000 00'); // => true
Determine if the biological birth gender of a citizen's NRN is male.
isBiologicalMale('860814 001 00'); // => true
Determine if the birthdate is known. It is possible (eg. for migrated people) to have an unknown date of birth.
isBirthdateKnown('860814 001 00'); // => true
isBirthdateKnown('002000 001 00'); // => false
Determine if an NRN number is also a BIS number.
isBisNumber('860814 001 00'); // => false
isBisNumber('862814 001 00'); // => true
Compare two NRN's for equality.
isEqual('860814 000 00', '86.08.14-000.00'); // => true
Determine if the gender is known. It is possible (eg. for migrated people) to have an unknown gender.
isGenderKnown('860814 000 00'); // => true
isGenderKnown('862814 000 00'); // => false
isGenderKnown('864814 000 00'); // => true
Determine if a citizen is legal adult.
isLegalAdult('860814 000 00'); // => true
Used internally for normalizing nrn strings. All we do is remove non-numeric characters.
normalize('86.08.14-000.84'); // => 86081400084
normalize('860814 000 84'); // => 86081400084
Used internally for parsing nrn strings. The resulting object can be used as input for all other functions.
parse('86.08.14-000.84');
// => { birthDate: '860814', serial: '000', checksum: '84' }