koblas / stdnum-js

A JavaScript library to provide functions to handle, parse and validate standard numbers.
MIT License
38 stars 26 forks source link

py-stdnum difference in Fødselsnummer #105

Closed teebu closed 11 months ago

teebu commented 11 months ago

This checks if the rest is between https://github.com/arthurdejong/python-stdnum/blob/master/stdnum/no/fodselsnummer.py#L103 and the js version checks if its just less then 1000

 elif 900 <= individual_digits < 1000 and year >= 40:
        year += 1900

number should be invalid: 45014054018

value taken from their doctest: https://github.com/arthurdejong/python-stdnum/blob/master/tests/test_no_fodselsnummer.doctest#L86

online validator: https://www.progsbase.com/algowidgets/norwegian-personal-identification-number-online/

their source: https://repo.progsbase.com/repoviewer/no.inductive.libraries/foedselsnummer/0.2.1///GetDateFromNorwegianPersonalIdentificationNumber/ (note: I think their 2000 calculation might be wrong)

image