Validate and generate danish social security numbers (cpr-nummer)
$ npm install danish-ssn
Validation is based on modulo-11 and century spans described in this document (in danish).
var cpr = require('danish-ssn')
console.log(cpr('061093-7438'))
Retrieve information contained by the cpr number, in the following format:
{ cpr: '0610937438',
valid: true,
date: new Date('1893-10-06T00:00:00.000Z'),
sex: 'Female' }
Returns whether or not the cpr number is valid*.
Makes a cpr number valid by correcting the check digit.
Returns null
if the cpr has no valid check digit.
Generates a list of all valid* cpr numbers for a given date.
*Note that since 2007, CPR numbers with invalid check digits has been issued for birthdays on January 1.
MIT