Code Monkey home page Code Monkey logo

nager.date's Introduction

GitHub Release Build status Docker Image CI

๐Ÿ“† Nager.Date - Official Website

Nager.Date is a popular project to query holidays. We currently support over 100 countries. The project is based on .NET but provides a REST interface to retrieve the data. There are several ways to use Nager.Date, there is a public api, you can start your own docker container or you can use the nuget package.

Nager.Date is open source software and is completely free for commercial use. If you would like to support the project you can award a GitHub star โญ or send a small donation to me ๐Ÿป

How can I use it?

If you are use .net you can install the package over nuget for all other languages we have a docker image with a web api available.

nuget

The package is available on nuget

PM> install-package Nager.Date

web api

  • public use the public api date.nager.at API
    • If you need more as 50 requests per day please use your own private api (docker).
  • private use the docker container available on dockerhub
    • docker run -d -p 80:80 nagerat/nager-date

Donation possibilities

If this project help you reduce time to develop, you can give me a beer ๐Ÿบ Donate

Examples for .NET (nuget package)

Get all publicHolidays of a country and year

var publicHolidays = DateSystem.GetPublicHoliday(2017, "DE");
foreach (var publicHoliday in publicHolidays)
{
    //publicHoliday...
    //publicHoliday.Date -> The date
    //publicHoliday.LocalName -> The local name
    //publicHoliday.Name -> The english name
    //publicHoliday.Fixed -> Is this public holiday every year on the same date
    //publicHoliday.Global -> Is this public holiday in every county (federal state)
    //publicHoliday.Counties -> Is the public holiday only valid for a special county ISO-3166-2 - Federal states
    //publicHoliday.Type -> Public, Bank, School, Authorities, Optional, Observance
}

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(startDate, endDate, CountryCode.DE);
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

nager.date's People

Contributors

tinohager avatar kreiden avatar jcron avatar rubenmonteiro avatar michael-blazevic avatar prasadtelkikar avatar deaflight avatar mkumar341 avatar metritutus avatar bacca87 avatar atvaark avatar mrcsabatoth avatar jemunk avatar matthijs110 avatar philmacdonald2 avatar hoetz avatar velykanov avatar robby123456 avatar dzonatan avatar simonachmueller avatar ctyar avatar webpapaya avatar norkunas avatar alex-jitbit avatar blowtorch avatar dlazzarino avatar pcphatweb avatar petrus0x13 avatar stemih333 avatar mauricioribeiro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.