Coder Social home page Coder Social logo

laloune / nager.date Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nager/nager.date

0.0 0.0 0.0 2.32 MB

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

Home Page: https://date.nager.at

License: MIT License

C# 70.72% CSS 18.08% ASP 0.02% JavaScript 2.29% HTML 8.90%

nager.date's Introduction

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 (November 2017)
PHP yasumi 29
JavaScript date-holidays 130
Java jollyday 64
.NET Holiday 21
Phyton python-holidays 20
Phyton workalendar 53

nager.date's People

Contributors

tinohager avatar kreiden avatar jcron avatar rubenmonteiro avatar bacca87 avatar deaflight avatar mrcsabatoth avatar jemunk avatar prasadtelkikar avatar hoetz avatar ahmetoz avatar pomma89 avatar andiih avatar clupasq avatar ersingencturk avatar joergbattermann avatar laoujin avatar loganbenjamin avatar kimpenhaus avatar mauricioribeiro avatar robby123456 avatar dzonatan avatar simonachmueller avatar alex-jitbit avatar dlazzarino avatar stemih333 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.