Nager.Date
1.38.0
dotnet add package Nager.Date --version 1.38.0
NuGet\Install-Package Nager.Date -Version 1.38.0
<PackageReference Include="Nager.Date" Version="1.38.0" />
paket add Nager.Date --version 1.38.0
#r "nuget: Nager.Date, 1.38.0"
// Install Nager.Date as a Cake Addin
#addin nuget:?package=Nager.Date&version=1.38.0
// Install Nager.Date as a Cake Tool
#tool nuget:?package=Nager.Date&version=1.38.0
Nager.Date
Nager.Date is a popular project to query holidays. We currently support over 100 countries.
Country Support
The list of supported countries can be found here
Examples
Get all publicHolidays of a country and year
var publicHolidays = DateSystem.GetPublicHolidays(2021, "DE");
foreach (var publicHoliday in publicHolidays)
{
//publicHoliday...
//publicHoliday.Date -> The date
//publicHoliday.LocalName -> The local name
//publicHoliday.Name -> The english name
//publicHoliday.Fixed -> Is this public holiday every year on the same date
//publicHoliday.Global -> Is this public holiday in every county (federal state)
//publicHoliday.Counties -> Is the public holiday only valid for a special county ISO-3166-2 - Federal states
//publicHoliday.Type -> Public, Bank, School, Authorities, Optional, Observance
}
Get all publicHolidays for a date range
var startDate = new DateTime(2016, 5, 1);
var endDate = new DateTime(2021, 5, 31);
var publicHolidays = DateSystem.GetPublicHolidays(startDate, endDate, CountryCode.DE);
foreach (var publicHoliday in publicHolidays)
{
//publicHoliday...
}
Check if a date is a public holiday
var date = new DateTime(2021, 1, 1);
if (DateSystem.IsPublicHoliday(date, CountryCode.DE))
{
Console.WriteLine("Is public holiday");
}
Check if a date is a weekend day
var date = new DateTime(2021, 1, 1);
if (DateSystem.IsWeekend(date, CountryCode.DE))
{
Console.WriteLine("Is weekend");
}
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows |
.NET Core | netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard2.0 netstandard2.1 |
.NET Framework | net461 net462 net463 net47 net471 net472 net48 net481 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen40 tizen60 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
-
.NETFramework 4.7.2
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
-
net6.0
- No dependencies.
NuGet packages (5)
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) |
|
Lava
Lava is a small Blazor components library |
|
MP_RPA_ReusableComponentPkg
A reusuable Component For Patient Statement and Billing |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Nager.Date:
Repository | Stars |
---|---|
Material-Blazor/Material.Blazor
Lightweight Material Theme components for Blazor
|
Version | Downloads | Last updated |
---|---|---|
1.38.0 | 5,165 | 1/11/2023 |
1.37.0 | 13,859 | 11/9/2022 |
1.36.4 | 11,416 | 10/4/2022 |
1.36.3 | 870 | 9/30/2022 |
1.36.2 | 2,229 | 9/19/2022 |
1.36.1 | 3,312 | 9/13/2022 |
1.36.0 | 1,289 | 9/11/2022 |
1.35.0 | 23,204 | 6/1/2022 |
1.34.1 | 19,657 | 5/2/2022 |
1.33.1 | 236,877 | 3/16/2022 |
1.32.0 | 99,504 | 1/22/2022 |
1.30.0 | 147,360 | 9/30/2021 |
1.29.2 | 257,994 | 6/21/2021 |
1.29.0 | 54,920 | 5/18/2021 |
1.28.2 | 181,071 | 3/8/2021 |
1.28.1 | 222,475 | 2/17/2021 |
1.26.6 | 80,929 | 11/23/2020 |
1.26.4 | 82,511 | 10/22/2020 |
1.26.3 | 81,636 | 8/26/2020 |
1.26.2 | 61,199 | 7/1/2020 |
1.26.0 | 103,150 | 5/29/2020 |
1.25.11 | 103,641 | 4/29/2020 |
1.25.10 | 409,891 | 1/14/2020 |
1.25.8 | 67,474 | 11/24/2019 |
1.25.7 | 37,232 | 10/30/2019 |
1.25.6 | 130,851 | 9/2/2019 |
1.25.4 | 18,856 | 8/9/2019 |
1.25.3 | 97,066 | 6/25/2019 |
1.24.9 | 77,668 | 4/22/2019 |
1.24.8 | 23,801 | 4/2/2019 |
1.24.7 | 28,158 | 3/5/2019 |
1.24.5 | 77,299 | 2/19/2019 |
1.24.0 | 65,690 | 1/12/2019 |
1.22.4 | 35,008 | 12/14/2018 |
1.22.3 | 77,465 | 10/18/2018 |
1.21.0 | 63,219 | 8/15/2018 |
1.20.3 | 43,814 | 6/22/2018 |
1.9.0 | 48,911 | 5/18/2017 |
1.6.0 | 4,054 | 3/26/2017 |
1.0.18 | 2,706 | 1/25/2017 |
1.0.7 | 1,968 | 5/14/2016 |
1.0.3 | 1,352 | 8/15/2014 |
A changelog is available at https://github.com/nager/Nager.Date/blob/master/CHANGELOG.md