Holidays 1.0.1

Get holidays for any year between 1901 and 2099. Also you can add custom holidays and manage with those dates as you wish.

Install-Package Holidays -Version 1.0.1
dotnet add package Holidays --version 1.0.1
<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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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&lt;string, DateTime&gt; 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 });

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&lt;string, DateTime&gt; 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 });

Release Notes

Added support for .Net Core 2.0 (under construction)

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.1 161 11/5/2018