So you want to put events on your website. You quickly knock together a program that stores events with some basic information: title, date, time, location, description. Then you make a list of events, sorted by date. Job done!
You show it to Mark in Public Programs and Events, and he says,
I have heaps of events that happen more than once, and I don't want to have to repeat the same information every time.
Job not done. Thanks Mark.
“That's easy,” you think. You change things around, and now you can add more than one date and time to an event.
Then you realise there are going to be too many events to fit on one page, so you put a calendar control on the page. That way you can see all the events on any given day, and it shows you today by default. Perfect.
But then Mark says,
This exhibition is on for several days at a time. It doesn't really have start times, it's just happening whenever we're open.
“Build it yourself, Mark,” is what you think, but what you say is, “That's OK.”
You make the time optional, so it can be an all-day event. You also add an "end" date and time, making sure the end happens after the start, of course. Now an event can go for many days at a time.
You realise you have to change the calendar display a bit, so the exhibition shows up on every day that it's on. Instead of showing events that start on a date, you need to show events that start before the end of the day and end after the start of the day. Oh, and you show all-day events before events with a time. It’s a bit weird to think about, but it works.
Mark also has an event that's on all the time, because it's permanently installed. After a bit of squinting, you realise you can just set a start date far in the past, and an end date far in the future, and override the dates display to say "every day".
This is all fine for a while, but then Mark calls up and says,
Sofia does three tours every day, and I don't want to put in every single date for ever and ever. Can we make events repeat automatically?
“Sure,” you say. You make a control to repeat events every day.
Then you start showing off. You know Mark has events that repeat weekly, every two weeks, and monthly.
Weekly and two-weekly is easy, you just repeat every seven or 14 days instead of every one day. But "monthly" is weird. What is one month after 31st August? Is it four weeks later, or the nearest date in September?
You check with Mark, and it's actually the last Thursday of every month. But not if it's Christmas Day, because we're closed on Christmas Day.
OK, this is going to be hard, but luckily you're smart and you realise your Google Calendar can do that.
After some research, you find the iCalendar standard, which has been around since 1998. It's pretty clunky, but someone's done the work, and you can use it to generate events that repeat on the last Thursday of every month, except Christmas Day. And you make a set of rules for all the kinds of repeats and call it good. If Mark changes the time of the first repeat, the times of all the following repeats automatically change to match.
Since your organisation runs events across the country, and your country has several time zones, you've made sure that the times have time zones attached, so you can display times in a local format. But then you realise that the tours that repeat every day have jumped back by an hour after the date when the clocks change. So you realise you can't just repeat the events from the Universal Coordinated Time, you have to use the local time for the event.
All is going well…
… until Jodie calls.
Is all this making your head hurt? Ohh, but there's so much more. Stay tuned.
If you're thinking of rebuilding all this, don't. Learn from people who've done it before.