Last week’s post on calculating what date Thanksgiving will fall on got me thinking, wouldn’t it be cool is there was an API that you can call to return holidays for a specific date, month or even the entire year? I did some digging and there were some premium API’s out there (one of which was a DLL file, ick, pluh) so I thought hey, may as well build one. The goal of the project was to maintain a future proof system for calculating holidays which exploits the power of the
strtotime() function and not having to store a database full of dates.
Thus far, the API supports United States federal and some non-federal holidays with a few exceptions. The exceptions thus far are Election and Inauguration days, Lunar New Year and any holidays that are related to the Hebrew calendar. The reason for their omission for the moment is the fact that they are based on non-Gregorian calendars and in the case of Election and Inauguration days, fall on specific dates every 4 years (those should be easy to include though).
The best part of this API is that I made it open source so anyone can contribute to it, perhaps provide a kick ass design for it, add in another country’s holidays as wejre only working on US right now or helping to figure out how to code in the Lunar or Hebrew calendar calculations!
You can check out the API here: http://holidayapi.com and the project on Github here: https://github.com/joshtronic/holidayapi.com