Skip to content

yangar/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 more than 60 countries if your country is not supported, fork me, implement it and send me the pull request.
  • Age calculation

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");
}

Calculate age

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

Country Support

Europe

  • Andorra
  • Åland
  • Austria
  • Belarus
  • Belgium
  • Bulgaria
  • Croatia
  • Cyprus
  • Czech Republic
  • Denmark
  • Estonia
  • Finland
  • France
  • Germany
  • Greece
  • Hungary
  • Iceland
  • Ireland
  • Isle of Man
  • Italy
  • Jersey
  • Latvia
  • Liechtenstein
  • Lithuania
  • Luxembourg
  • Malta
  • Monaco
  • Netherlands
  • Norway
  • Poland
  • Portugal
  • Romania
  • Russia
  • Slovakia
  • Slovenia
  • Spain
  • Sweden
  • Switzerland
  • Turkey (without muslim based holidays)
  • Ukraine
  • United Kingdom

Asia

  • China
  • Kazakhstan
  • Mongolia
  • Russia
  • Turkey (without muslim based holidays)

North America

  • Bahamas
  • Canada
  • Costa Rica
  • Cuba
  • Dominican Republic
  • Guatemala
  • Haiti
  • Jamaica
  • Mexico
  • Panama
  • Puerto Rico
  • United States

South America

  • Argentina
  • Bolivia
  • Brazil
  • Chile
  • Colombia
  • Ecuador
  • Guyana
  • Honduras
  • Paraguay
  • Peru
  • Suriname
  • Uruguay
  • Venezuela

Atlantic

  • Greenland

Africa

  • Botswana
  • Madagascar
  • Namibia
  • South Africa

Australia & Pacific

  • Australia
  • New Zealand

Alternative projects

Language Project
PHP yasumi
JavaScript date-holidays
Java jollyday
.NET Holiday

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 95.3%
  • JavaScript 4.3%
  • Other 0.4%