Page 1 of 1

National Holidays

Posted: Sun Dec 31, 2006 4:07 am
by onion2k
I'm writing a calendar system at the moment, and one small aspect of it is to highlight dates that are national holidays. This presents a bit of a challenge. Fortunately, being in the UK, I can work out most of them programmatically, but the government here has had a bit of fun the last few years moving them temporarily for special occasions (the Queen's Golden Jubilee for example). I imagine the same sort of thing happens in other countries too.

This leaves me with a few options.
  • Code a system to calculate them and ignore the fact they might be wrong occasionally.
  • Code the next 5 years worth into the database, add an admin option to add/remove/change them.
  • A combination of the two options above.
  • Write a web service that runs on my site that feeds holiday dates, and make the application grab them every week so that I can change them remotely.
Or something else I've not thought of. It seems something obvious for a web service to provide but I can't find anyone offering it so I'm wondering if I've missed something.

Thoughts?

Posted: Sun Dec 31, 2006 4:58 am
by Kieran Huggins
Apple offers webcal calendars you could subscribe to:

http://www.apple.com/macosx/features/ical/library/

UK holidays: webcal://ical.mac.com/ical/UK32Holidays.ics

Then just dump them into a database and make them editable. Just remember to keep the original date in a field (timestamp?) so you don't re-add edited events.

Posted: Sun Dec 31, 2006 6:03 am
by onion2k
Interesting. Quite a nice format there. Only problems with using Apple's feed is that they might get rid of it one day, and I can't add things to it (eg 'New IJ Release') in the same way I could if I had my own. It's food for thought though.

Posted: Sun Dec 31, 2006 8:40 am
by feyd
I like all the options you've thought up. Something that came to my mind was writing a plug-in interface so that someone could simply inject special events and such into the calendar by those methods or their own methods.

Posted: Sun Dec 31, 2006 2:09 pm
by Kieran Huggins
I'm only suggesting you seed it with apple's calendar, then you must manage it yourself. You could use a calendar app like Sunbird to download the calendar, then save it in another format (xml maybe?) directly on the server. That way you could manage the calendar with a calendar app, parsing the XML into the database whenever the md5() of the file changes.

Then if the XML on the server changes (by way of a PHP script or another instance of Sunbird) everything will stay in sync, since Sunbird is built to download a fresh copy of your calendar from the server before making edits.