Skip to content
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

Birth year #15

Closed
stef-iula opened this issue Oct 11, 2021 · 9 comments
Closed

Birth year #15

stef-iula opened this issue Oct 11, 2021 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@stef-iula
Copy link

stef-iula commented Oct 11, 2021

Python version
3.8.6

Package version
0.3.7

Current behavior (bug description)
Tax codes with "21" as birth year are decoded as 2021

Expected behavior
Tax codes with "21" as birth year decoded correctly as 1921 or 2021

@stef-iula stef-iula added the bug Something isn't working label Oct 11, 2021
@fabiocaccamo
Copy link
Owner

@stef-iula do you have any idea regarding how to solve this problem?

@stef-iula
Copy link
Author

@fabiocaccamo to be honest I haven't looked yet into your code nor in any of the other packages that do this to understand how to fix the issue, but I'll keep you posted! I opened the issue because I think it's good to have a reference!

@fabiocaccamo
Copy link
Owner

fabiocaccamo commented Oct 11, 2021

@stef-iula my question doesn't require that you read the code, because the problem is that from the "Codice Fiscale" it is possible to obtain only the last 2 digits of the year, so it is impossible to distinguish if 21 means 1921 or 2021.
For this reason I decided to give priority to the more recent year in these cases.

@stef-iula
Copy link
Author

I am aware of how it works and the fact that this basically has to be modulo 100 yrs but I tried one of these corner cases on this website https://www.codicefiscale.com/inverso.php and it worked properly so I was wondering if there's a way solving it.

@fabiocaccamo
Copy link
Owner

Using https://www.codicefiscale.com/inverso.php try to generate your own CF twice, the first time with birthdate year 1921 and the second time with year 2021, you will obtain the same code... Probably they do just the opposite (they do precedence to the older year), but the problem is the same.

@stef-iula
Copy link
Author

I tried decoding several times the CF that gave me problems (I can't share for privacy reasons) and I always got the right result -- 1921 as birth year.

@fabiocaccamo
Copy link
Owner

Sure, but if you would decode the code of a child born in 2021, you will obtain 1921 anyway, there is not solution.

@stef-iula stef-iula changed the title Anno di nascita Birth year Oct 11, 2021
@stef-iula
Copy link
Author

stef-iula commented Oct 11, 2021

I see.. well, hopefully it's about corner cases so I'd better find a way to handle them in my app. Thanks a lot for the discussion, closing this since there appears to be no solution :)
Cheers!

@fabiocaccamo
Copy link
Owner

Yes, it is really a corner case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants