NinUtilsNorway 1.2.1

dotnet add package NinUtilsNorway --version 1.2.1
NuGet\Install-Package NinUtilsNorway -Version 1.2.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NinUtilsNorway" Version="1.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NinUtilsNorway --version 1.2.1
#r "nuget: NinUtilsNorway, 1.2.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NinUtilsNorway as a Cake Addin
#addin nuget:?package=NinUtilsNorway&version=1.2.1

// Install NinUtilsNorway as a Cake Tool
#tool nuget:?package=NinUtilsNorway&version=1.2.1

Library NinUtilsNorway

Namespaces

NinUtilsNorway

Gender

Gender enum : Unknown = 0 | Female = 1 | Male = 2

Fields
Name Summary
Female Female
Male Male
Unknown Unknown gender

IDateTimeNowProvider

Used for mocking date times

Methods
Name Summary
GetToday() Retrieves the Today value (DateTime.Today for example). Useful for mocking / unit testing.

NinUtilsNorway

Util methods for Nin (National identifier number) in Norway

Methods
Name Summary
GetAge(System.String nin, NinUtilsNorway.IDateTimeNowProvider nowTimeProvider) Calculates age from Nin
GetBirthDateFromNin(System.String nin) Calculates birth date from nin based on rules from https://www.skatteetaten.no/person/folkeregister/fodsel-og-navnevalg/barn-fodt-i-norge/fodselsnummer/|
GetControlDigitsForNin(System.String)
GetGender(System.String nin) Resolves gender from nin. Rule is that the first six digits are the birth date DDMMYYYY followed by 3 'individual digits' (individnummer) and finally two control digits (kontrollsiffer). The third digit of 'individual digits' are the indicator for gender. If even number, female individual, if odd number, male individual.
IsDNumber(System.String nin) Returns true if a person is having a D-number. A d-number is given to foreign workers in Norway as a temporary identifier during their work period. It is similar to a ordinary Nin (fødselsnummer), but for the first digit in the nin, we add 4. This gives 4,5,6,7 as possible digits for the first digits. A lot of other characteristics of D-number are similar to ordinary Nin, including the two control digits follow same rules.
IsDufNumber(System.String, NinUtilsNorway.IDateTimeNowProvider) Checks if this is a DUF-number. These numbers are given by UDI The check is only checking it is a number with 12 digits. The number must also reside in UDI data systems, which this method do not check.
IsFHNumber(System.String nin) FH numbers are developed by KITH as a proposal established as a standard 18.01.2010. It is similar to Nin fødselsnumre with 11 digits, and the first digit is 8 or 9. The numbers in position 2 - 9 are generated as random numbers. This standard conceals also gender, birthdate or which order the number is provided. The algorithms allows about 200 million numbers minus 17% of these due to incorrect control digits (last two digits). Examples of people getting a FH-number are tourists, newborn (infants), unconcious people not identified, unidentified people or similar reasons that a fødselsnummer Nin or D-Number is not available.
IsHelpNumber(System.String nin, System.Boolean useEightNineConventionFirstDigitConvention) Checks if this is a help number H-number. The default convention for H-number is that it we add the number 4 to the third digit
IsValidNin(System.String nin) Calculates validity of Nin according to modulo 11 algorithm.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.1 410 10/7/2022
1.2.0 368 10/7/2022
1.1.0 454 3/11/2022
1.0.0 402 3/5/2022

Added method GetBirthDateFromNin. Support for people born in 18th century in GetAge method has now an overload parameter which must be set to true.