Today I’m proud to publish the Public Holiday Toolkit. To give you a short summary. Using this toolkit enables you to show public holidays for several countries within your .NET application. This can be interessting for many use cases. Think about calendars, appointments and so on.
What does the Toolkit offer?
The Public Holiday Toolkit comprises the holiday ruleset for Germany, New Zealand, Norway, Austria, Poland, Swiss, United Kingdom and the USA including all administrative districts. Furthermore it comprises an API for accessing the public holiday definitions, an Example Application and a Holiday Editor to create new rulesets for other countries.
How can I use it?
The holiday API is quite simple and contains only 4 methods.
/// This class encapsulates all business methods to work with public holidays.
public interface IHolidayService
/// Loads a list with all countries and their public holiday definitions.
List<Country> GetHolidayDefinitionsFromXml(string xmlFile);
/// Saves a list with countries and their public holiday definitions.
/// Existing files will be overwritten and replaced by the new holiday definition.
void SetHolidayDefinitionsToXml(string xmlFile, List<Country> countries);
/// Searches a specific country and district object for their public
/// holidays within a given time frame. The result is not the holiday class
/// itself, but a proxy object that contains the holiday definition.
/// This is because holidays can be occure more than onces, if the
/// timeframe covers more than one year.
List<HolidayEntry> SearchHolidays(Country country, District district, DateTime startRange, DateTime endRange);
/// Searches the weekends for a given time frame.
List<HolidayEntry> SearchWeekends(DateTime startRange, DateTime endRange);
Do you have an example ?
Sure. An example application is provided within the download of the Public Holiday Toolkit. It’s only a small application, but it shows how to read the holiday definitions and show them within your application.
What about creating public holiday definitions for other countries?
If you need to create or update public holiday definitions you can use the Holiday Editor within the Toolkit. The Holiday Editor enables you to modify the Holiday Definitions. I would be very glad if you could share new or updated holiday definitions with me and the public. Please send your created holiday definitions to me and I will publish them on this blog.
Here’s a screenshot of the Holiday Editor.
Where can I get it?
Simply download the Public Holiday Toolkit from the following location: http://wordpress.ad-factum.de/PHT_1.0.zip
What else do I have to know?
The Public Holiday Toolkit uses the AdFactum ObjectMapper .NET in order to store and read the public holiday definitions. License informations about the AdFactum ObjectMapper .NET can be found here.
For now? Nothing. Feel free to use the holiday definition file and service component within your .NET application. As I already said: I would be happy If you could share some new holiday definitions of other countries with me.