Skip to content

C# Public holiday calculation. Please star (★) this project!

License

Notifications You must be signed in to change notification settings

v-manolov/Nager.Date

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Release

Nager.Date

Nager.Date is a Date/Calendar Framework for .NET

  • Public holiday calculation for every year, based on easter sunday, country and county support. Supports over 90 countries.
  • Weekend information (supports 120 countries)
  • Age calculation

If your country is not supported, fork me, implement it and send me the pull request.

Website / API

https://date.nager.at

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

Examples

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 is a public holiday

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

Check if a date is a weekend day

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

Calculate age

var date = new DateTime(1900, 1, 1);
var age = DateSystem.GetAge(date);

Country Support

The list of supported countries can be found on the wiki.

Areas of Application

  • telephone systems
  • carrier (land transport)
  • time recording

Blog Posts

Mark Seemann - Simple holidays

Alternative projects

Language Project Supported Countries (January 2019)
PHP yasumi 34
JavaScript date-holidays 142
Java jollyday 64
.NET Holiday 21
Python python-holidays 34
Python workalendar 59

About

C# Public holiday calculation. Please star (★) this project!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 74.9%
  • CSS 15.5%
  • HTML 7.6%
  • JavaScript 2.0%