Skip to content

About

Generate Swedish Personal Identity Numbers

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

6 stars

Watchers

2 watching

Forks

Repository files navigation

generate Build Status NPM Downloads

Generate Swedish Personal Identity Numbers.

Installation

npm install @personnummer/generate

Usage

import generate from '@personnummer/generate';

const today = new Date();

// generate with date object
let pin = generate(today);

// generate with random date between now and the previous hundred years and the next hundred years
pin = generate();

// generate with specific gender
pin = generate({ gender: 'male' }); // or 'female'

// generate with date object and with specific gender
pin = generate(today, { gender: 'male' }); // or 'female'

Options

{
  gender: '',    // '' (random), 'male' or 'female',
  format: 'long' // 'long' or 'short'
}

This package follows the output format specification.

In memoriam

Fredrik "Frozzare" Forsmo (1991-2026) was the initiator, co-founder and a core contributor of the personnummer project. This library carries his work. He is missed.

License

MIT

About

Generate Swedish Personal Identity Numbers

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

6 stars

Watchers

2 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages