Giter Site home page Giter Site logo

eartharoid / holidays Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 37 KB

Data and APIs for public/bank holidays.

Home Page: https://holidays.eartharoid.me

License: MIT License

JavaScript 100.00%
api bank-holidays cloudflare-workers holiday-api holiday-calculation holidays public-holidays

holidays's Introduction

๐Ÿšง Work in progress ๐Ÿšง

https://github.com/workalendar/workalendar/blob/master/workalendar/europe/united_kingdom.py https://github.com/workalendar/workalendar/blob/master/workalendar/europe/united_kingdom.py https://www.ukbankholidays.co.uk/ https://en.wikipedia.org/wiki/Wedding_of_Princess_Anne_and_Mark_Phillips https://en.wikipedia.org/wiki/Public_holidays_in_the_United_Kingdom

Holidays

Data and APIs for public/bank holidays in supported countries.

Why?

To add a minor feature to one of my other projects, I needed a simple way to check if today is a holiday that worked for most countries, and I wasn't satisfied with the existing solutions. Unfortunately, holidays are not as simple as they seem (cough Scotland).

What's wrong with existing solutions?

Most of them work, but after looking at several open-source projects that calculate dates, I was stuck thinking about how the code would be better represented as data.

  • https://www.gov.uk/bank-holidays.json: only works for the UK
  • Nager.Date: accurate, but the API isn't flexible enough to overcome regional inconsistencies, not multi-lingual
  • holidayapi.com: stupidly expensive
  • timeanddate.com: probably very good, but even more stupidly expensive
  • Azure Open Datasets: difficult to access, probably doesn't get updated
  • enrico: weird API and uses XML
  • python-holidays: excellent, but I didn't want to make an API in python
  • workalendar: good, but python again
  • date-holidays: FINALLY! someone decided to make data with rules instead of code.... but not well. In my opinion, its far more confusing and difficult to follow or update than any of the solutions above that use code

Goals and scope

There have been many changed and additional UK holidays in the last few years, so this was made with the following goals in mind:

Limitations

Data for the last decade, the current decade, and the next decade (currently 2010-2039 inclusive) is available for supported countries with the free API.

Read the documentation โ†’

Libraries

JavaScript

This provides some helper functions for working with the computed data, such as getting the next holiday, checking if today is a holiday, etc.

Must be paired with @eartharoid/holidays-calculator or pre-computed data (e.g. @eartharoid/holidays-static) to be useful.

This is the core library that calculates the dates of holidays in a given year using the rules data. It is used to generate the static data files in dist and @eartharoid/holidays-static.

Pre-computed data, as in dist, ready for use with @eartharoid/holidays.

Static files

You can use these JSON files in your non-JavaScript projects. All of the last decade, the current decade, and the next decade is available (currently 2010-2039 inclusive). The files are available in the dist directory and can be downloaded from the CDN:

https://cdn.jsdelivr.net/gh/eartharoid/holidays/dist/v1/[year]/[country].json

e.g. https://cdn.jsdelivr.net/gh/eartharoid/holidays/dist/v1/2023/gb.json

Warning You should update local copies at least every 3 months to ensure new holidays are included.

Countries

Please consider sponsoring (or donating to) your country's contributors.

Contributing

Please help to add countries and missing or incorrect holidays.

Read the contributing guidelines for more information.

License

Data (data/*.yml, dist/v1/*.json, and output from the library and API) is available under the Open Database License.

Everything else is licensed under the MIT License.

holidays's People

Contributors

eartharoid avatar

Stargazers

 avatar

Watchers

 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.