npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rodnecislo

v1.6.0

Published

A package for handling Czech and Slovak Personal ID

Downloads

4,396

Readme

A npm package for validating and deriving information from Czech and Slovak National Identification Number. This number is used in Czech and Slovak Republic as the primary unique identifier for every person by most, if not all, government institutions, banks, etc. It consists of two parts: birth date (with gender mark) and serial number with check digit. It is commonly known as Birth Number or rodné číslo in both Czech and Slovak hence the library name.

Install

Works with nodejs v10 and higer (ES2015).

npm install rodnecislo

Usage

import { rodnecislo } from 'rodnecislo';
// let { rodnecislo } = require("rodnecislo")

let rc = rodnecislo('111213/3121')

rc.isMale()     // true
rc.isFemale()   // false

rc.year()       // 2011
rc.month()      // 11 - zero based month
rc.day()        // 13

rc.birthDate()  // new Date(2011, 11, 13) - "Tue Dec 13 2011 00:00:00 GMT+0100 (CET)"
rc.birthDateAsString() // "13.12.2011" - the Czech date format

rc.isValid()    // true
rc.isPossible() // true (valid, but maybe in the future)

rc.isAdult()    // false - by default checks if current date is above 18 years old
rc.isAdult(21)  // false - for US

rc.age()        // 5 - age today (it is 5.6.2017 ;)

rc.dic()        // "CZ1112133121" - Czech Tax Identification Number (DIč)

Definitions and legislation

Dictionary

  • birth number - National Identification Number in Czech and Slovak republic
  • birth date part - first 6 digits of birth number, typically divided with serial number with slash '/'
  • serial number - 3 digits diferentiating people born on the same day, occurs after '/'
  • check digit - last digit of the birth number, making it divisible by 11 (with exceptions)
  • DIC - czech VAT number

Historical evolution

Before 1953

  • People in Czechoslovakia have Personal ID Card Number or Work ID Card Number. It isn't called birth number/rodne cislo yet.
  • It has format yymmdd/sss
  • Women have mm+50
  • sss is serial number for people born on the same day
  • Eg: 516231/016 is birth number of a female, born on 31 Dec 1951

After 1953

  • Birth number is official now
  • It has format: yymmdd/sssc
  • Women have: mm+50
  • Whole PIN must be divisible by 11 OR
  • If (yymmddsss % 11 == 10 && c == 0) then the birth number is valid

After 1985

  • The (yymmddsss % 11 == 10 && c == 0) exception was removed
  • ... every new birth number must be divisible by 11 as a whole from now on

In 1993 Czechoslovakia split into Czech Republic and Slovak Republic

  • the legislation might differ from this point on

After 2004

  • Since 2004 (law nr. 53/2004) it is possible to add extra 20 to the month number in case the number of newborns exceeds all the possible combinations of birth date/birth number divisible by 11. In conclusion:
    • Men can also have mm+20
    • Women can also have mm+70

So to wrap it up

Short/long version

  • Short version was used before 1953
  • Long version AND yy >= 54 THEN yyyy = 19yy
  • Long version AND yy < 53 THEN yyyy = 20yy
  • Who knows what comes in 2053...

Month/Gender

  • Month is 51-62 OR 71-82 - female, subtract 50 and 70 respectively
  • Month is 01-12 OR 21-32 - male, subtract 20

Modulo condition

  • Short birth number - no modulo condition
  • Whole birth number is divisible by 11 - valid birth number
  • Whole birth number without check digit modulo 11 equals 10 AND check digit is 0 AND year is 54-85 - valid birth number

Age and Adultood

According to Civil code §601 law n. 89/2012 and §30 of New Civil Code an age is reached at midnight which is starting the birthday. So on the first seconds of your 18th birthday you can start drinking in Czech.

VAT Identification Number

In Czech the personal VAT Identification Number is derived from Birth Number by adding CZ prefix and ommitting the slash. It is called Daňové identifikační číslo (DIČ) hence the .dic() method.

Sources

Specification comes mainly from following links:

RegExp

RegExp for rodné číslo. With/without slash.

  |   1   |      2a      |       2b      |       2c      |       2d       |             3          |4 |    5   |
/^\d{0,2}((0[1-9]|1[0-2])|(2[1-9]|3[0-2])|(5[1-9]|6[0-2])|(7[1-9]|8[0-2]))(0[1-9]|[1-2][0-9]|3[01])\/?[0-9]{3,4}$/;

Explanation:

  • 1 - 00-99 birth year, i.e. yy
  • 2 birth month, i.e. mm
    • a - 01-12 for men
    • b - 21-32 for men*
    • c - 51-62 for women
    • d - 71-82 for women*
  • 3 - 01-31 birth day, .i.e. dd
  • 4 - slash
  • 5 - 000-9999 serial and check digit, .i.e xxxx

Unanswered Questions

  • What happens to birth number in 2053?
  • How many colisions in birth number are there?

Author

Jakub Podlaha [email protected]

License

MIT : http://opensource.org/licenses/MIT

Contributing

Don't hesitate to let me know about errors and/or possible uselessnesses. I did this for my project first but would be glad if others find this useful.