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 https://github.com/commenthol/date-holidays/blob/master/docs/specification.md#citations-sources-and-attribution https://github.com/commenthol/date-holidays/blob/master/docs/specification.md#types-of-holidays https://en.wikipedia.org/wiki/Civil_Service_(United_Kingdom)#Privilege_days
Data and APIs for public/bank holidays in supported countries.
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).
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
There have been many changed and additional UK holidays in the last few years, so this was made with the following goals in mind:
- Although it can be if someone does the research, this shouldn't be expected to be historically accurate.
- https://www.officeholidays.com/countries/united-kingdom https://support.google.com/calendar/answer/6084659
You can use the data either
- through the HTTP API
- by downloading or building a database (which can optionally queried with a helper library)
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.
These URLs have a cache time of 1 week. You should update local copies at least every few months to ensure correctness.
https://static.eartharoid.me/holidays/v1/<country>.<size>.<format>
Note
<country>
may be an ISO 3166-1 alpha-2 country code, or global
.
Size | Years |
---|---|
xs |
(1) current year |
sm |
(3) previous, current, & next year |
lg |
(11) current year ± 5 years |
xl |
(30) previous, current, & next decade |
sqlite
json
Examples:
https://static.eartharoid.me/holidays/v1/global.xl.sqlite
https://static.eartharoid.me/holidays/v1/gb.sm.json
Please consider sponsoring or donating to your country's contributors.
Note
what about international calendars?
Country | Code | From | Contributors |
---|---|---|---|
United Kingdom | GB |
1995 | @eartharoid |
Please help to add countries and missing or incorrect holidays.
Read the contributing guidelines for more information.
Data (data/*.yml
) is available under the Open Database License.
Everything else is licensed under the MIT License.