stdnum.no.fodselsnummer

Fødselsnummer (Norwegian birth number, the national identity number).

The Fødselsnummer is an eleven-digit number that is built up of the date of birth of the person, a serial number and two check digits.

More information:

>>> validate('151086 95088')
'15108695088'
>>> get_gender('151086-95088')
'F'
>>> validate('15108695077')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> format('15108695077')
'151086 95077'
stdnum.no.fodselsnummer.calc_check_digit1(number: str) str

Calculate the first check digit for the number.

stdnum.no.fodselsnummer.calc_check_digit2(number: str) str

Calculate the second check digit for the number.

stdnum.no.fodselsnummer.compact(number: str) str

Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

stdnum.no.fodselsnummer.format(number: str) str

Reformat the number to the standard presentation format.

stdnum.no.fodselsnummer.get_birth_date(number: str) date

Determine and return the birth date.

stdnum.no.fodselsnummer.get_gender(number: str) str

Get the person’s birth gender (‘M’ or ‘F’).

stdnum.no.fodselsnummer.is_valid(number: str) bool

Check if the number is a valid birth number.

stdnum.no.fodselsnummer.validate(number: str) str

Check if the number is a valid birth number.