Javascript object for managing the italian tax code.
bower install codice-fiscale --save
or
npm install codice-fiscale-js --save
Add the Object file
<script src="./CodiceFiscale.min.js" type="text/javascript"></script>
Use the function to calculate the tax code
var person = new CodiceFiscale({
name: "Mario",
lastname: "Rossi",
day: "25",
month: "04",
year: "1945",
isMale: true,
communeName: "Milano",
});
Use the public function for getting specific taxcode part
person.taxCode(); // RSSMRA45D25F205N
person.lastnameCode(); // RSS
person.nameCode(); // MRA
person.dateCode(); // 45D25
person.yearCode(); // 45
person.monthCode(); // D
person.dayCode(); // 25
person.communeCode(); // F205
person.controlChar(); // N
This is an issue in italian system. In this case government offices change chars without a real algorithm because we don't know how many omocodias there're in this moment. Here there's a good explanation for calculating it.
It consists in replacing one or more of the seven numbers of the code, starting from the rightmost one, with the corresponding letters below:
0 = L | 1 = M | 2 = N | 3 = P | 4 = Q
5 = R | 6 = S | 7 = T | 8 = U | 9 = V
The control char calculation don't work properly, so the last tax code's char is not always right.
- Change npm package name to
codice-fiscale-js
- Run npm audit fix for security
- Run npm audit fix for security
- Run npm audit fix for security
- Updated cadastral codes from Agenzia delle Entrate
- General fixes
- Added on bower packages
- Fix bower.json file for publishing
- Added beautified script on dist
- New functions for setting and getting properties
- Functions now have correct scope
- Properties refactoring
- Complete refactoring of the code
- CodiceFiscale is an Object with a constructor
- Create public function for specific taxcode part
- Fixed control char calculation
- Initialize the code
- CodiceFiscale is an Object without constructor
- Used the original logic code
The code is freely taken from zingus.altervista.org. This is a refactoring code finally here, on Github.