Holidays 1.0.1

dotnet add package Holidays --version 1.0.1
NuGet\Install-Package Holidays -Version 1.0.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="Holidays" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Holidays --version 1.0.1
#r "nuget: Holidays, 1.0.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 Holidays as a Cake Addin
#addin nuget:?package=Holidays&version=1.0.1

// Install Holidays as a Cake Tool
#tool nuget:?package=Holidays&version=1.0.1

Holidays

Library to provide a list of official holidays from an year. Get holidays for any year between 1901 and 2099. Also you can add custom holidays and manage with those dates as you wish.

Supported countries

Currently, the library has embedded support to the countries in table below, including moveable holidays.

Country Moveable holidays
Brazil Christian holidays
Portugal Christian holidays

Instalation

To install the Nuget package, run the following command in the Package Manager Console on Visual Studio:

PM> Install-Package Holidays

Or download package directly from Nuget.org

Usage

Basically, you can create an instance of NationalHolidays class or use the static methods and after chain the year to the OfYear method, as you want:

var year = System.DateTime.Today.Year;
var brazilianHolidaysOfYear = NationalHolidays.FromBrazil.OfYear(year);
// or
brazilianHolidaysOfYear = NationalHolidays.From("br").OfYear(year);

var protugueseHolidaysOfYear = NationalHolidays.FromPortugal.OfYear(year);
// or
protugueseHolidaysOfYear = NationalHolidays.From("pt").OfYear(year);

The result is a Dictionary<string, DateTime> that represents the holiday description and its repective date on those year.

Warning The library has embedded only the national holidays, but includes also those that move acording the Christian events, such as Carnival and Easter (using Gauss algorithm).

var christianHolidays = new ChristianHolidays(DateTime.Today.Year);
var carnivalDateOnYear = christianHolidays.Carnival;
var easterDateOnYear = christianHolidays.Easter;

If you are interested only in the fixed holidays, you could get them as below:

var brazilianFixedHolidays = NationalHolidays.FromBrazil.FixedHolidays;

Note that is not necessary inform the year. The return is a collection of Holiday objects, that contains the holiday description, the day, the month of the year and a holiday type (National, Observance, Optional, Local, Season, etc)

You can add your custom dates:

var customHolidayDate = new System.DateTime(System.DateTime.Today.Year, 5, 15);
holidays.AddCustom("some holiday", customHolidayDate);
// or
var customHoliday = new Holiday{ Description = "some holiday", Day = 1, Month = 2, Type = HolidayType.Local };
holidays.Add(customHoliday);
// or
holidays.AddRange(
   new Holiday{ Description = "some holiday 1", Day = 1, Month = 2, Type = HolidayType.Local }, 
   new Holiday { Description = "some holiday 2", Day = 2, Month = 3, Type = HolidayType.Local });
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 net40 is compatible.  net403 was computed.  net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  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.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Holidays:

Package Downloads
Evoluze.Roboluze

Biblioteca Dominio Fiscal

Roboluze.Config

Biblioteca de configurações

LiturgicalHolidays

Calculates Protestant holidays for any date between 1901 and 2099.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 11,400 11/5/2018

Added support for .Net Core 2.0 (under construction)