RepositoryC#ATAustria
nager

nager/Nager.Date

Easily access public holidays for 200+ countries via .NET, REST API, Docker, or NuGet for online and offline use.

1.4kstars
229forks
35issues
4views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: calendar-api

#1 Repository of the week

1
TINIX TRENDING·Topic: public-holidays

#1 Repository of the week

1
TINIX TRENDING·Topic: holiday-api

#1 Repository of the week

Build, Test & Publish

:calendar: Nager.Date - Official Website

Discover the convenience of easily accessing holidays from over 100 countries with Nager.Date. Our popular project utilizes the power of .NET and offers a user-friendly public REST API for seamless integration into your application.

You can find an overview of the supported countries here.

Need offline access to our functionality? No problem! We also provide solutions that allow you to use our services on your own infrastructure without an internet connection. Easily integrate our service into your system with the Docker container or the NuGet package. Both options require a license key. As a sponsor of nager, you get a license key.

How can I use it?

Easily generate a client in your preferred programming language by utilizing our API documentation, which provides a complete overview of all available endpoints. For more details on client generation, refer to the OpenAPI Generator documentation.

Examples

.NET/C# (click to expand)

There are two ways to use our service

NuGet - Nager.Holiday

PM> install-package Nager.Holiday

Copy Code

using System;
using System.Net.Http;
using System.Text.Json;

var jsonSerializerOptions = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };

using var httpClient = new HttpClient();
using var response = await httpClient.GetAsync("https://date.nager.at/api/v3/publicholidays/2022/US");
if (response.IsSuccessStatusCode)
{
    using var jsonStream = await response.Content.ReadAsStreamAsync();
    var publicHolidays = JsonSerializer.Deserialize<PublicHoliday[]>(jsonStream, jsonSerializerOptions);
}

class PublicHoliday
{
    public DateTime Date { get; set; }
    public string LocalName { get; set; }
    public string Name { get; set; }
    public string CountryCode { get; set; }
    public bool Global { get; set; }
    public string[] Counties { get; set; }
    public string[] Types { get; set; }
}
PHP (click to expand)

This example use the guzzle project

<?php
require_once 'vendor/autoload.php';
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://date.nager.at/api/v3/publicholidays/2022/US');
if ($response->getStatusCode() == 200) {
    $json = $response->getBody();
    print_r(json_decode($json));
}
?>
Java (click to expand)

This example use the springframework. Code tested with onecompiler.com

Main.java

import java.util.*;
import org.springframework.web.client.RestTemplate;
import com.google.gson.*;

public class Main {
  public static void main(String[] args) {
    System.out.println("get holidays");
    String json = new RestTemplate().getForObject("https://date.nager.at/api/v3/publicholidays/2022/CH", String.class);
    
    Gson gson = new Gson();
    PublicHoliday[] userArray = gson.fromJson(json, PublicHoliday[].class);  

    for(PublicHoliday publicHoliday : userArray) {
      System.out.print(publicHoliday.date);
      System.out.print(" ");
      System.out.print(publicHoliday.name);
      System.out.print(" ");
      System.out.print(String.join(",", publicHoliday.counties ?? new String[0]));
      System.out.print(" ");
      System.out.println(publicHoliday.localName);
    }
  }
}

PublicHoliday.java

public class PublicHoliday {
  public String date;
  public String localName;
  public String name;
  public String countryCode ;
  public Boolean fixed;
  public Boolean global;
  public String[] counties;
  public String[] types;
}

build.gradle

apply plugin:'application'
mainClassName = 'Main'

run { standardInput = System.in }
sourceSets { main { java { srcDir './' } } }

repositories {
  jcenter()
}

dependencies {
  implementation 'org.springframework.boot:spring-boot-starter-web:2.6.7';
  implementation 'com.google.code.gson:gson:2.10.1';
}
Python (click to expand)

main.py

import json
import requests

response = requests.get('https://date.nager.at/api/v3/publicholidays/2022/US')
public_holidays = json.loads(response.content)

for public_holiday in public_holidays:
  print(public_holiday['date'])

Offline Solution

Don't let internet connectivity issues disrupt your workflow. Our offline solutions enable you to use our services on your own infrastructure without an internet connection. With a sponsorship you get the license key to use the variants locally without a dependency to our REST API.

NuGet

The NuGet package is available via NuGet

PM> install-package Nager.Date
Code Examples (click to expand)

Examples for .NET (NuGet package)

Set the license key

HolidaySystem.LicenseKey = "TheLicenseKey";

Check the license

var licenseKey = "TheLicenseKey";
var licenseInfo = Nager.Date.License.LicenseHelper.CheckLicenseKey(licenseKey);
if (licenseInfo is null)
{
    //license key invalid
    return;
}

if (licenseInfo.ValidUntil < DateTime.Today)
{
    //license key expired
    return;
}

Get all holidays of a country and year

var holidays = HolidaySystem.GetHolidays(2024, "DE");
foreach (var holiday in holidays)
{
    //holiday...
    //holiday.Date -> The date
    //holiday.ObservedDate -> The date on which the holiday is observed
    //holiday.LocalName -> The local name
    //holiday.EnglishName -> The english name
    //holiday.NationalHoliday -> Is this public holiday in every county (federal state)
    //holiday.SubdivisionCodes -> Is the public holiday only valid for a special county ISO-3166-2 - Federal states
    //holiday.HolidayTypes -> Public, Bank, School, Authorities, Optional, Observance
}

Get all holidays for a date range

var startDate = new DateTime(2016, 5, 1);
var endDate = new DateTime(2024, 5, 31);
var holidays = HolidaySystem.GetHolidays(startDate, endDate, CountryCode.DE);
foreach (var holiday in holidays)
{
	//holiday...
}

Check if a date is a public holiday

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

Checks if the given date falls on a weekend day

var date = new DateTime(2024, 1, 1);
if (WeekendSystem.IsWeekend(date, CountryCode.DE))
{
    Console.WriteLine("The date is in the weekend");
}

Docker

The Docker container is available via Docker Hub
To run a local instance of the Docker image run the following command
docker run -p 80:8080 nager/nager-date

Holiday types

What variants of holidays are supported by Nager.Date

TypeDescription
PublicPublic holiday
BankBank holiday, banks and offices are closed
SchoolSchool holiday, schools are closed
AuthoritiesAuthorities are closed
OptionalMajority of people take a day off
ObservanceOptional festivity, no paid day off

Release and Support Lifecycle

Here you can see how long the product will be supported and when the End of Life (EOL) is planned.

ProductRelease DateSupportedEnd of life
WebApi v4under developmentNo-
WebApi v32021-05-18Yes-
WebApi v22019-02-10No2024-12-01
WebApi v12017-02-06No2024-06-24
Nuget Package v22024-03-07Yes-
Nuget Package v12014-08-15No2024-03-07

Data precision

There is no generally valid designation for the next administrative level of countries. "Nager.Date" supports the initial subdivision of a country, but we will not support a detailed level because the effort required is too high.

To keep it generally valid, we will treat this subdivision as SubdivisionCodes, this will replace the current designation Counties.

  • United States of America use States
  • Germany use States
  • Austria use States
  • Switzerland use Cantons
  • Brazil use States
  • Australia use States or Territories
  • Russia use Federal districts
  • Canada use Province or Territories
PrecisionSupported
Public Holidays for specific CountryYes
Holidays for Subdivisions based on ISO 3166-2 (first level)Yes
Holidays for CitiesNo
Holidays for RegionsNo

Limitation Regarding Islamic Holidays

Some Islamic holidays (e.g., Eid al-Fitr, Eid al-Adha) are based on the Islamic lunar calendar and are often determined by local moon sightings. As this depends on weather conditions and geographic location, these dates cannot be reliably calculated in advance. Therefore, such holidays are not included in this project.

Areas of Application

There are several business fields in which it is important to know the holidays in different countries.

  • E-commerce: If an online retailer sells its products in different countries, it should know the holidays in these countries to adjust delivery times and customer service accordingly.
  • Travel industry: A tour operator should know the holidays of the countries to which it offers trips, to alert its customers to special events or closed attractions.
  • Staff scheduling: Companies with branches in several countries must know the holidays in each country to be able to plan their staff needs accordingly.
  • Financial industry: Banks and financial institutions should know the holidays in the countries in which they conduct business to ensure that transfers and transactions are performed on time and to estimate the impact of holidays on the foreign exchange market.
  • Logistics and supply chains: Companies managing logistics or supply chains across several countries, must know the holidays in these countries to adjust planning and supply chain decisions.
  • Telephone systems: To automatically turn on the answering machine on holidays.
  • Time recording: To automatically fill the missing hours with the normal working hours.

Articles about this project

Similar Projects

Discover other similar projects and AI models.

RepositoryJava
focus-shift/jollyday

Jollyday - A worldwide public holidays library

144
Nov 26, 2026
RepositoryPython
vacanza/holidays

Open World Holidays Framework

2.0k
Dec 2, 2026
RepositoryPHP
azuyalabs/yasumi

The easy PHP Library for calculating holidays

1.1k
Nov 23, 2026
RepositoryRuby
billaul/active_period

Smart-Period aims to simplify Time-range manipulation

78
Aug 14, 2025
RepositoryPython
GothenburgBitFactory/holidata

Holidata is the core of holidata.net, a no-nonsense, ad-free provider of international holiday data.

59
Nov 15, 2026
RepositoryJava
huanghaibin-dev/CalendarView

RecyclerView? ListView or ViewGroup? No, it's Canvas! Ultra performance and free customization interface! Vertical and horizontal, Fast rendering and extremely low memory. Android上一个优雅、万能自定义UI、仿iOS、自定义动画,支持垂直、水平方向切换、支持周视图、自定义周起始、性能高效的日历控件,热插拔实现UI定制!Canvas绘制,渲染速度快、占用内存低,你真的想不到日历居然还可以如此优雅。

9.4k
Dec 4, 2025
RepositoryJavaScript
commenthol/date-holidays

worldwide holidays

1.1k
Nov 29, 2026
RepositoryJava
svendiedrichsen/jollyday

Jollyday - A holiday API

197
May 1, 2024
RepositoryJavaScript
cg-zhou/holiday-calendar

标准化的节假日数据集(JSON格式),包含法定假期、调休安排等信息。 | Standardized JSON dataset of holidays and working calendar for regions.

142
Nov 5, 2026