{"id":22281704,"url":"https://github.com/personnummer/csharp","last_synced_at":"2025-04-07T06:11:30.827Z","repository":{"id":26143970,"uuid":"107449099","full_name":"personnummer/csharp","owner":"personnummer","description":"Validate Swedish personal identity numbers","archived":false,"fork":false,"pushed_at":"2025-02-12T08:41:04.000Z","size":156,"stargazers_count":14,"open_issues_count":2,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-31T05:05:52.234Z","etag":null,"topics":["csharp","hacktoberfest","personal-identity-number","personnummer","social-security-number","validation"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/personnummer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"open_collective":"sweidproject"}},"created_at":"2017-10-18T18:46:23.000Z","updated_at":"2025-02-12T08:40:44.000Z","dependencies_parsed_at":"2023-12-23T04:20:17.628Z","dependency_job_id":"b6cf2245-48f2-4e04-bf83-253e72fe9506","html_url":"https://github.com/personnummer/csharp","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/personnummer%2Fcsharp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/personnummer%2Fcsharp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/personnummer%2Fcsharp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/personnummer%2Fcsharp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/personnummer","download_url":"https://codeload.github.com/personnummer/csharp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601448,"owners_count":20964864,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","hacktoberfest","personal-identity-number","personnummer","social-security-number","validation"],"created_at":"2024-12-03T16:20:56.547Z","updated_at":"2025-04-07T06:11:30.806Z","avatar_url":"https://github.com/personnummer.png","language":"C#","funding_links":["https://opencollective.com/sweidproject"],"categories":[],"sub_categories":[],"readme":"# Personnummer\n\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/personnummer/csharp/csharp.yml?branch=master)](https://github.com/personnummer/csharp/actions)\n[![NuGet Downloads](https://shields.io/nuget/dt/personnummer)](https://www.nuget.org/packages/Personnummer)\n\nValidate Swedish social security numbers.\n\n## Installation\n\n```\ndotnet add package Personnummer\n```\n\n## Examples\n\n### Validation\n\n```csharp\nusing Personnummer;\n\nclass Test \n{\n  public void TestValidation() \n  {\n    Personnummer.Valid(\"191212121212\");     // =\u003e True\n    Personnummer.Valid(\"121212+1212\")       // =\u003e True\n    Personnummer.Valid(\"20121212-1212\")     // =\u003e True\n  }\n}\n```\n\n### Format\n\n```csharp\nusing Personnummer;\n\n// Short format (YYMMDD-XXXX)\n(new Personnummer(\"1212121212\")).Format();\n//=\u003e 121212-1212\n\n// Short format for 100+ years old\n(new Personnummer(\"191212121212\")).Format();\n//=\u003e 121212+1212\n\n// Long format (YYYYMMDDXXXX)\n(new Personnummer(\"1212121212\")).Format(true);\n//=\u003e 201212121212\n```\n\n### Age\n\n```csharp\nusing Personnummer;\n\n(new Personnummer(\"1212121212\")).Age;\n//=\u003e 7\n```\n\n### Get sex\n\n```csharp\n\n\n(new Personnummer(\"1212121212\")).IsMale;\n//=\u003e true\n(new Personnummer(\"1212121212\")).IsFemale;\n//=\u003e false\n```\n\n### Coordination numbers\n\nThe package supports coordination numbers. This feature is enabled by default\nand can be disabled by passing an option object to the constructor, parse \nor validate function.\n\n```csharp\nPersonnummer.Parse(\"193405619996\"); // True.\nPersonnummer.Parse(\"193405619996\", new { AllowCoordinationNumber = true }); // False.\n```\n\n### Interim / T -numbers\n\nThe package supports interim (aka T) -numbers. This feature is not enabled by \ndefault as they are commonly used, but can be enabled by passing an option object\nto the constructor, parse of validate function.\n\n```csharp\nPersonnummer.Parse(\"20000101T220\", new { AllowInterimNumber = true }); // True.\n```\n\nSee `Personnummer.Test/PersonnummerTest.cs` for more examples.\n\n## License\n\n```\nMIT License\n\nCopyright (c) Personnummer and Contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpersonnummer%2Fcsharp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpersonnummer%2Fcsharp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpersonnummer%2Fcsharp/lists"}