Marketto / codice-fiscale-utils

Utility to handle Italian Codice Fiscale
MIT License
24 stars 10 forks source link

cfDecode fails with CF of people born in january #92

Closed condesully closed 10 months ago

condesully commented 1 year ago

Environment: OS: Windows 10 Chrome's Version 108.0.5359.125 (official Build) (at 64 bit) Node v16.13.2 Platform [ ] nodeJs [X] Web/Browser

Issue description: The method cfDecode of codiceFiscale Parser fails to parse CF of people born in january.

Steps to reproduce the problem: Given the VAT BRTRCR90A17G224C Try to call .Parser.cfDecode("BRTRCR90A17G224C") The result is: { firstName: 'R*C*R*', lastName: 'B*R*T*', day: 17, month: undefined, year: 1990, date: undefined, gender: 'M', place: 'Padova', omocodeId: 0 }

Expected behavior { firstName: 'R*C*R*', lastName: 'B*R*T*', day: 17, month: 0, year: 1990, date: 1990-01-17T00:00:00.000Z, gender: 'M', place: 'Padova', omocodeId: 0 }

Other Using codice-fiscale-utils v2.1.0

Solution https://github.com/Marketto/codice-fiscale-utils/blob/0da8572679bb5f2d01af501482035381f9971c97/src/classes/parser.class.ts#L288 change || to ??