-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix validation of personal numbers (years 2000-2009) #46
Conversation
Pad least significant digits in a year with zero. Fixes case when year < 10 (e.g. year == 0 would have produced new_y 190 and 200 instead of 1900 and 2000)
Awesome, thanks for your pull request. Can you add a test case that verifies this? |
I would say the whole Btw, not everyone born in those 2000-2009 (also 1900-1909) will be impacted. It's only people born in leap years on Feb. 29 (for example, someone born in 2000-02-29 will fail validation). Because a date of This is an example SSN that will fail validation incorrectly:
On a similar note, it is possible for this method to create false positives as well, not only false negatives. For example, 2020 was not a leap year, but 1920 was. So if someone uses an SSN with a valid Luhn checksum but uses the '2020-02-29' date, it will flag it as positive. For example, the following SSN should not be valid [redacted].
|
The python version of personnummer isn't maintained unfortunately, so not much will happen until we have someone that can help with that. Me and the others has enough of packages to maintain, but I can try to answer at least. We will try to get some info about which packages are maintained or not on the site and in the repos. I've looked up The second part about leap year I don't understand since you're saying that |
@frozzare Yes, sorry about the 2020 one. I don't know what I was thinking, lol. (I edited and redacted the ssn from my previous comment as it may be real). Regarding the first part, yes, it's related to the Python version due to how the package tests the dates. I'll send in a separate PR shortly since one looks to be stale. |
Thanks for your contribution! Much appreciated :) |
Replaced with #57 |
Type of change
Description
Pad least significant digits in a
year
variable with zero. Fixes case whenyear < 10
(e.g. year == 0 would have producednew_y
190 and 200instead of 1900 and 2000) leading to failed validation of some of
personal numbers for people born in years 2000-2009.
Related issue
None.
Motivation
Fixes significant bug in validating of personal numbers (e.g. personal numbers of people born in years 2000-2009 may be affected).
Checklist