Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
RO.cnprejects CNPs that use the county code70, which Romania now issues.Since 2024, CNPs generated automatically by the Integrated Information System for civil status documents carry the single code
70in the county position (digits 8 and 9), whatever the place of birth. The Ministry of Internal Affairs confirmed this in a statement from 11 May 2024:https://www.mai.gov.ro/precizari-in-ceea-ce-priveste-generarea-codului-numeric-personal/
src/ro/cnp.tsonly knows the codes01to48,51and52, so every one of these numbers fails withInvalidComponent, even when the date and check digit are correct.Fix
Add the missing codes to the
COUNTIESmap, exactly as python-stdnum does instdnum/ro/cnp.py:70: any registration, regardless of county80,81,82,83: listed as valid by several sources, meaning unclearUpstream change: arthurdejong/python-stdnum@7a9b852 ("Mark more Romanian CNP county codes as valid", closes arthurdejong/python-stdnum#489, released in 2.2). The labels
AnyandUnknownare the same as upstream.No other logic changes. Unknown codes such as
99are still rejected.Tests
Added four cases to
src/ro/cnp.spec.ts:5240512700014: county70, valid5240512700013: same number with a wrong check digit,InvalidChecksum5240512830010: county83, valid1630615993454: county99, stillInvalidComponent(same example as the python-stdnum doctest)The check digits were verified by hand and against python-stdnum's
validate().npm run lintpasses, andnpm testpasses withTZ=UTC(as in CI). In a UTC+3 timezone,src/mx/curp.spec.ts(getBirthDate) fails locally. It fails onmaintoo and is unrelated to this change.