Nager.Date
1.45.0
dotnet add package Nager.Date --version 1.45.0
NuGet\Install-Package Nager.Date -Version 1.45.0
<PackageReference Include="Nager.Date" Version="1.45.0" />
paket add Nager.Date --version 1.45.0
#r "nuget: Nager.Date, 1.45.0"
// Install Nager.Date as a Cake Addin
#addin nuget:?package=Nager.Date&version=1.45.0
// Install Nager.Date as a Cake Tool
#tool nuget:?package=Nager.Date&version=1.45.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 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. |
.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. |
-
.NETFramework 4.7.2
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
-
net6.0
- No dependencies.
NuGet packages (6)
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 |
|
MoreDateTime
A package to simplify dealing with .NET DateTime, DateOnly and TimeOnly objects |
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.45.0 | 6,864 | 8/27/2023 |
1.44.0 | 290 | 8/22/2023 |
1.43.0 | 15,412 | 6/26/2023 |
1.42.0 | 13,199 | 4/24/2023 |
1.41.0 | 2,720 | 4/18/2023 |
1.40.0 | 9,884 | 3/5/2023 |
1.39.0 | 4,963 | 2/11/2023 |
1.38.0 | 25,276 | 1/11/2023 |
1.37.0 | 35,263 | 11/9/2022 |
1.36.4 | 16,827 | 10/4/2022 |
1.36.3 | 1,057 | 9/30/2022 |
1.36.2 | 4,964 | 9/19/2022 |
1.36.1 | 5,574 | 9/13/2022 |
1.36.0 | 3,187 | 9/11/2022 |
1.35.0 | 27,906 | 6/1/2022 |
1.34.1 | 25,384 | 5/2/2022 |
1.33.1 | 429,855 | 3/16/2022 |
1.32.0 | 175,802 | 1/22/2022 |
1.30.0 | 217,590 | 9/30/2021 |
1.29.2 | 364,906 | 6/21/2021 |
1.29.0 | 66,699 | 5/18/2021 |
1.28.2 | 199,540 | 3/8/2021 |
1.28.1 | 243,085 | 2/17/2021 |
1.26.6 | 122,035 | 11/23/2020 |
1.26.4 | 102,978 | 10/22/2020 |
1.26.3 | 97,175 | 8/26/2020 |
1.26.2 | 72,385 | 7/1/2020 |
1.26.0 | 228,915 | 5/29/2020 |
1.25.11 | 134,302 | 4/29/2020 |
1.25.10 | 445,719 | 1/14/2020 |
1.25.8 | 76,443 | 11/24/2019 |
1.25.7 | 45,732 | 10/30/2019 |
1.25.6 | 147,462 | 9/2/2019 |
1.25.4 | 19,870 | 8/9/2019 |
1.25.3 | 108,105 | 6/25/2019 |
1.24.9 | 88,999 | 4/22/2019 |
1.24.8 | 27,368 | 4/2/2019 |
1.24.7 | 32,562 | 3/5/2019 |
1.24.5 | 97,094 | 2/19/2019 |
1.24.0 | 65,807 | 1/12/2019 |
1.22.4 | 36,491 | 12/14/2018 |
1.22.3 | 82,602 | 10/18/2018 |
1.21.0 | 70,321 | 8/15/2018 |
1.20.3 | 54,356 | 6/22/2018 |
1.9.0 | 53,631 | 5/18/2017 |
1.6.0 | 4,282 | 3/26/2017 |
1.0.18 | 3,190 | 1/25/2017 |
1.0.7 | 2,097 | 5/14/2016 |
1.0.3 | 1,482 | 8/15/2014 |
A changelog is available at https://github.com/nager/Nager.Date/blob/master/CHANGELOG.md