Nager.Date 2.9.2

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Nager.Date --version 2.9.2
                    
NuGet\Install-Package Nager.Date -Version 2.9.2
                    
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="Nager.Date" Version="2.9.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nager.Date" Version="2.9.2" />
                    
Directory.Packages.props
<PackageReference Include="Nager.Date" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Nager.Date --version 2.9.2
                    
#r "nuget: Nager.Date, 2.9.2"
                    
#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.
#:package Nager.Date@2.9.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Nager.Date&version=2.9.2
                    
Install as a Cake Addin
#tool nuget:?package=Nager.Date&version=2.9.2
                    
Install as a Cake Tool

Nager.Date

Nager.Date is a comprehensive .NET library for querying public and federal holidays, supporting over 110 countries worldwide. It provides native and English translations and supports country subdivisions (federal states) according to ISO 3166-2 standards.

Supported Countries

You can see the full list of supported countries here

Features

  • Query public, federal, bank, school, and optional holidays (availability may vary by country).
  • Support for country subdivisions (federal states, provinces).
  • Native and English translations for holiday names.
  • Retrieve holidays by year or date range.
  • Check if a specific date is a public holiday.
  • Weekend detection for any country.

Getting Started

Set License Key

HolidaySystem.LicenseKey = "TheLicenseKey";

Check License

var licenseKey = "TheLicenseKey";
var licenseInfo = Nager.Date.Helpers.LicenseHelper.CheckLicenseKey(licenseKey);
if (licenseInfo is null)
{
    //license key invalid
    return;
}

if (licenseInfo.ValidUntil < DateTime.Today)
{
    //license key expired
    return;
}

Get Holidays for a Year

var holidays = HolidaySystem.GetHolidays(2024, "DE");
foreach (var holiday in holidays)
{
    Console.WriteLine($"{holiday.Date:yyyy-MM-dd} - {holiday.EnglishName}");
    //holiday...
    //holiday.Date -> The date
    //holiday.ObservedDate -> The date on which the holiday is observed
    //holiday.LocalName -> The local name
    //holiday.EnglishName -> The english name
    //holiday.NationalHoliday -> Is this holiday in every county (federal state)
    //holiday.SubdivisionCodes -> Is the holiday only valid for a special county ISO-3166-2 - Federal states
    //holiday.HolidayTypes -> Public, Bank, School, Authorities, Optional, Observance
}

Get Holidays for a Date Range

var startDate = new DateTime(2016, 5, 1);
var endDate = new DateTime(2024, 5, 31);
var holidays = HolidaySystem.GetHolidays(startDate, endDate, CountryCode.DE);
foreach (var holiday in holidays)
{
	//holiday...
}

Check if a date is a public holiday

var date = new DateTime(2024, 1, 1);
if (HolidaySystem.IsPublicHoliday(date, CountryCode.DE))
{
    Console.WriteLine("This date is a public holiday.");
}

Check if a Date is on a Weekend

var date = new DateTime(2024, 1, 1);
if (WeekendSystem.IsWeekend(date, CountryCode.DE))
{
    Console.WriteLine("The date falls on a weekend.");
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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 is compatible.  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.

NuGet packages (7)

Showing the top 5 NuGet packages that depend on Nager.Date:

Package Downloads
YellowCanary.IntervalQL

Package Description

DateTimeConversionExtensions

A library of extension mehods to help convert times between time zones, add business days to a date time etc. Hat tip no Nager Date for calculating holidays and weekends for adding business days. Date time conversions use .Net's System.TimeZoneInfo.

Brazil.DateTime

Brazil DateTime extension (Timezone convert, holidays, business days)

MoreDateTime

A package to simplify dealing with .NET DateTime, DateOnly and TimeOnly objects

Lava

Lava is a small Blazor components library

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Nager.Date:

Repository Stars
CodeMazeBlog/CodeMazeGuides
The main repository for all the Code Maze guides
Version Downloads Last Updated
2.10.1 126 9/19/2025
2.10.0 283 9/18/2025
2.9.2 1,233 9/12/2025
2.9.1 26,165 8/20/2025
2.9.0 18,436 6/11/2025
2.8.7 3,256 6/2/2025
2.8.6 3,575 5/27/2025
2.8.5 3,944 5/12/2025
2.8.4 945 5/9/2025
2.8.3 14,539 4/16/2025
2.8.2 142,567 3/17/2025
2.8.1 4,647 3/5/2025
2.8.0 36,768 2/7/2025
2.7.5 21,386 1/16/2025
2.7.4 4,740 1/8/2025
2.7.3 603 1/7/2025
2.7.2 15,475 12/2/2024
2.7.1 90,685 11/15/2024
2.7.0 7,466 11/5/2024
2.6.7 5,831 10/21/2024
2.6.6 856 10/18/2024
2.6.5 52,275 10/12/2024
2.6.4 1,592 10/7/2024
2.6.3 574 10/7/2024
2.6.2 6,985 10/4/2024
2.6.1 3,371 10/1/2024
2.6.0 315 9/30/2024
2.5.3 4,253 9/25/2024
2.5.2 3,664 9/18/2024
2.5.1 8,390 9/2/2024
2.5.0 7,411 8/20/2024
2.4.1 50,100 7/11/2024
2.4.0 39,838 4/28/2024
2.3.1 11,060 4/14/2024
2.3.0 48,989 3/28/2024
2.2.2 3,655 3/21/2024
2.2.1 443 3/19/2024
2.2.0 2,610 3/17/2024
2.1.0 584 3/13/2024
2.0.2 462 3/8/2024
2.0.1 232 3/8/2024
2.0.0 1,641 3/7/2024
1.48.0 112,184 2/12/2024
1.47.1 71,492 12/13/2023
1.47.0 12,115 11/21/2023
1.46.0 31,197 10/10/2023
1.45.0 22,153 8/27/2023
1.44.0 1,018 8/22/2023
1.43.0 42,037 6/26/2023
1.42.0 39,719 4/24/2023
1.41.0 8,188 4/18/2023
1.40.0 3,977,332 3/5/2023
1.39.0 8,467 2/11/2023
1.38.0 41,984 1/11/2023
1.37.0 84,105 11/9/2022
1.36.4 27,409 10/4/2022
1.36.3 1,293 9/30/2022
1.36.2 8,424 9/19/2022
1.36.1 5,939 9/13/2022
1.36.0 4,827 9/11/2022
1.35.0 71,869 6/1/2022
1.34.1 34,856 5/2/2022
1.33.1 963,442 3/16/2022
1.32.0 395,659 1/22/2022
1.30.0 421,728 9/30/2021
1.29.2 715,844 6/21/2021 1.29.2 is deprecated because it is no longer maintained.
1.29.0 99,127 5/18/2021 1.29.0 is deprecated because it is no longer maintained.
1.28.2 253,632 3/8/2021 1.28.2 is deprecated because it is no longer maintained.
1.28.1 299,522 2/17/2021 1.28.1 is deprecated because it is no longer maintained.
1.26.6 266,043 11/23/2020 1.26.6 is deprecated because it is no longer maintained.
1.26.4 187,774 10/22/2020 1.26.4 is deprecated because it is no longer maintained.
1.26.3 127,519 8/26/2020 1.26.3 is deprecated because it is no longer maintained.
1.26.2 109,607 7/1/2020 1.26.2 is deprecated because it is no longer maintained.
1.26.0 4,816,437 5/29/2020 1.26.0 is deprecated because it is no longer maintained.
1.25.11 212,567 4/29/2020 1.25.11 is deprecated because it is no longer maintained.
1.25.10 519,588 1/14/2020 1.25.10 is deprecated because it is no longer maintained.
1.25.8 105,325 11/24/2019 1.25.8 is deprecated because it is no longer maintained.
1.25.7 78,050 10/30/2019 1.25.7 is deprecated because it is no longer maintained.
1.25.6 306,583 9/2/2019 1.25.6 is deprecated because it is no longer maintained.
1.25.4 22,561 8/9/2019 1.25.4 is deprecated because it is no longer maintained.
1.25.3 130,495 6/25/2019 1.25.3 is deprecated because it is no longer maintained.
1.24.9 115,339 4/22/2019 1.24.9 is deprecated because it is no longer maintained.
1.24.8 31,686 4/2/2019 1.24.8 is deprecated because it is no longer maintained.
1.24.7 42,396 3/5/2019 1.24.7 is deprecated because it is no longer maintained.
1.24.5 108,948 2/19/2019 1.24.5 is deprecated because it is no longer maintained.
1.24.0 67,440 1/12/2019 1.24.0 is deprecated because it is no longer maintained.
1.22.4 41,064 12/14/2018 1.22.4 is deprecated because it is no longer maintained.
1.22.3 93,512 10/18/2018 1.22.3 is deprecated because it is no longer maintained.
1.21.0 89,011 8/15/2018 1.21.0 is deprecated because it is no longer maintained.
1.20.3 81,417 6/22/2018 1.20.3 is deprecated because it is no longer maintained.
1.9.0 67,046 5/18/2017 1.9.0 is deprecated because it is no longer maintained.
1.6.0 4,721 3/26/2017 1.6.0 is deprecated because it is no longer maintained.
1.0.18 4,569 1/25/2017 1.0.18 is deprecated because it is no longer maintained.
1.0.7 2,544 5/14/2016 1.0.7 is deprecated because it is no longer maintained.
1.0.3 1,923 8/15/2014 1.0.3 is deprecated because it is no longer maintained.

A changelog is available at https://github.com/nager/Nager.Date/releases