Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pattern for Creating Recurring Events

Every now and then I face some feature that would be better if I put some recurring hability in it.

To make it clear let me use a known example. In Google Calendar, when I set an event as recurring let´s say every monday, it will show it every Monday. I can keep rolling the weeks forward and it will show the event.

I don´t really believe that they create the event in the database for every monday until the eternity :-), nor they create it until some far far away year.

I´d like to know if there´s some well known pattern for doing such a thing or any guide with best practices.

Thank You.

like image 365
Ricardo Acras Avatar asked Jan 24 '11 14:01

Ricardo Acras


People also ask

What are the possible patterns for a recurring appointment?

Daily appointments recur every day, every set number of days, or every weekday. Weekly appointments recur on the same day of the week every week, or every certain number of weeks. Monthly appointments recur on the same day of the month (the 10th), or on the same day of a certain week of the month (the third Monday).

How do I create a recurring event in Excel?

Click Task, click the bottom part of the Task button and then click Recurring Task. In the Task Name box, type the recurring task's name. In the Duration box, add the duration of each occurrence of the task. In the Recurrence pattern section, click Daily, Weekly, Monthly, or Yearly.

What is a recurring event called?

cycle, oscillation. a single complete execution of a periodically repeated phenomenon. repeat, repetition. an event that repeats.


1 Answers

As far as I'm concerned, Martin Fowler has the definitive word on how to describe recurrences from a data modelling point of view. Once you've captured recurrences, you just need to provide code to retrieve events for a given date(time).

like image 84
Pontus Gagge Avatar answered Oct 10 '22 04:10

Pontus Gagge