bchavez / Bogus

:card_index: A simple fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js.
Other
8.51k stars 483 forks source link

Fix for issue #534: Gender-digit is incorrect for Swedish Personnummer generation #535

Closed LarsBergqvist closed 4 months ago

LarsBergqvist commented 4 months ago

For a Swedish Personnummer (social security number), the last digit is a Luhn-checksum. The second last digit is odd for a person with male legal gender and even for a person with female legal gender. You can read about it here: https://skatteverket.se/privat/folkbokforing/personnummer.4.3810a01c150939e893f18c29.html The implementation in ExtensionsForSweden.cs was implemented the other way around for male/female. This PR fixes the gender digit and the corresponding unit tests.