Skip to content

Andi482/Nager.Date

 
 

Repository files navigation

GitHub Release

Nager.Date

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.

Demo Website

http://publicholiday.azurewebsites.net

nuget

The package is available on nuget

PM> install-package Nager.Date

Exampels

Get all publicHolidays of a country and year

var publicHolidays = DateSystem.GetPublicHoliday("DE", 2017);
foreach (var publicHoliday in publicHolidays)
{
	//publicHoliday...
}

Get all publicHolidays for a date range

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...
}

Check if a date a public holiday

var date = new DateTime(2017, 1, 1);
if (DateSystem.IsPublicHoliday(date, CountryCode.DE))
{
	Console.WriteLine("Is public holiday");
}

Country Support

Europe

  • 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

North America

  • Canada
  • United States

South America

  • Bolivia
  • Brazil
  • Honduras
  • Paraguay
  • Peru

Atlantic

  • Greenland

Africa

  • Botswana
  • Madagascar
  • Namibia
  • South Africa

Australia & Pacific

  • New Zealand

Packages

No packages published

Languages

  • C# 93.8%
  • JavaScript 5.9%
  • Other 0.3%