Public holiday calculation for every year, based on easter sunday, country and county support. Supports more than 40 countries if your country is not supported, fork me, implement it and send me the pull request.
http://publicholiday.azurewebsites.net
The package is available on nuget
PM> install-package Nager.Date
var publicHolidays = DateSystem.GetPublicHoliday("DE", 2017);
foreach (var publicHoliday in publicHolidays)
{
//publicHoliday...
}
var startDate = new DateTime(2016, 5, 1);
var endDate = new DateTime(2018, 5, 31);
var publicHolidays = DateSystem.GetPublicHoliday(CountryCode.DE, startDate, endDate);
foreach (var publicHoliday in publicHolidays)
{
//publicHoliday...
}
var date = new DateTime(2017, 1, 1);
if (DateSystem.IsPublicHoliday(date, CountryCode.DE))
{
Console.WriteLine("Is public holiday");
}
- Austria
- Belarus
- Belgium
- Bulgaria
- Croatia
- Cyprus
- Czech Republic
- Denmark
- Estonia
- Finland
- France
- Germany
- Greece
- Hungary
- Iceland
- Ireland
- Italy
- Latvia
- Liechtenstein
- Lithuania
- Luxembourg
- Malta
- Netherlands
- Norway
- Poland
- Portugal
- Romania
- Russia
- Slovakia
- Slovenia
- Spain
- Sweden
- Switzerland
- United Kingdom
- Canada
- United States
- Bolivia
- Brazil
- Honduras
- Paraguay
- Peru
- Greenland
- Botswana
- Madagascar
- Namibia
- South Africa
- New Zealand