Skip to content

hungdluit/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 50 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

Donation possibilities

If this project help you reduce time to develop, you can give me a beer 🍺

  • Donate
  • BTC: 3PjuVRcAaKPv9yLLmrVUY9mqGngPDm3nPc (Bitcoin)

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
  • Turkey (without muslim based holidays)
  • United Kingdom

North America

  • Bahamas
  • Canada
  • Guatemala
  • United States

South America

  • Bolivia
  • Brazil
  • Honduras
  • Paraguay
  • Peru

Atlantic

  • Greenland

Africa

  • Botswana
  • Madagascar
  • Namibia
  • South Africa

Australia & Pacific

  • Australia
  • New Zealand

Packages

No packages published

Languages

  • C# 94.2%
  • JavaScript 5.5%
  • Other 0.3%