Skip to content

Latest commit

 

History

History
254 lines (231 loc) · 5.14 KB

README.md

File metadata and controls

254 lines (231 loc) · 5.14 KB

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

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
  • 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);

Europe (39/49)


  • Albania
  • Åland
  • Andorra
  • Austria
  • Belarus
  • Belgium
  • Bosnia and Herzegovina
  • Bulgaria
  • Croatia
  • Cyprus
  • Czech Republic
  • Denmark
  • Estonia
  • Finland
  • France
  • Germany
  • Greece
  • Hungary
  • Iceland
  • Ireland
  • Isle of Man
  • Italy
  • Kosovo
  • Jersey
  • Latvia
  • Liechtenstein
  • Lithuania
  • Luxembourg
  • Macedonia
  • Malta
  • Moldova
  • Monaco
  • Montenegro
  • Netherlands
  • Norway
  • Poland
  • Portugal
  • Romania
  • Russia
  • San Marino
  • Serbia
  • Slovakia
  • Slovenia
  • Spain
  • Sweden
  • Switzerland
  • Ukraine
  • United Kingdom
  • Vatican City

Asia (3/50)


  • Armenia
  • China (without Qingming (Tomb-Sweeping Day))
  • Georgia
  • Kazakhstan
  • Mongolia
  • Russia
  • Turkey (without muslim based holidays)

North America (4/4)


  • Canada
  • Greenland
  • Mexico
  • United States

Central America and the Antilles (11/22)


  • Bahamas
  • Barbados
  • Belize
  • Costa Rica
  • Cuba
  • Curacao
  • Dominica
  • Dominican Republic
  • El Salvador
  • Grenada
  • Guatemala
  • Haiti
  • Honduras
  • Jamaica
  • Nicaragua
  • Panama
  • Puerto Rico
  • Saint Kitts and Nevis
  • Saint Lucia
  • Saint Vincent and the Grenadines
  • Trinidad and Tobago
  • Turks and Caicos

South America (13/14)


  • Argentina
  • Bolivia
  • Brazil
  • Chile
  • Colombia
  • Ecuador
  • French Guiana
  • Guyana (without muslim based holidays and hindu based holidays)
  • Paraguay
  • Peru
  • Suriname
  • Uruguay
  • Venezuela

Africa (4/58)


  • Algeria
  • Angola
  • Benin
  • Botswana
  • Burkina Faso
  • Burundi
  • Cameroon
  • Cape Verde
  • Chad
  • Central African Republic
  • Comoros
  • Republic of the Congo
  • Democratic Republic of the Congo
  • Côte d'Ivoire
  • Djibouti
  • Egypt
  • Equatorial Guinea
  • Eritrea
  • Ethiopia
  • Gabon
  • The Gambia
  • Ghana
  • Guinea
  • Guinea-Bissau
  • Kenya
  • Lesotho
  • Liberia
  • Libya
  • Madagascar
  • Malawi
  • Mali
  • Mauritania
  • Mauritius
  • Morocco
  • Mozambique
  • Namibia
  • Niger
  • Nigeria
  • Rwanda
  • São Tomé and Príncipe
  • Senegal
  • Seychelles
  • Sierra Leone
  • Somalia
  • South Africa
  • South Sudan
  • Sudan
  • Swaziland
  • Tanzania
  • Togo
  • Tunisia
  • Uganda
  • Western Sahara
  • Zambia
  • Zimbabwe

Australia & Pacific


  • Australia
  • New Zealand

Areas of Application

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

Blog Posts

Mark Seemann - Simple holidays

Alternative projects

Language Project Supported Countries (November 2017)
PHP yasumi 29
JavaScript date-holidays 130
Java jollyday 64
.NET Holiday 21
Phyton python-holidays 20
Phyton workalendar 53