simple module to manipulate recurring dates

Skip Montanaro skip@mojam.com
Sat, 07 Aug 99 01:03:40 GMT


In Musi-Cal I frequently need to deal with recurring dates such as "every
Monday from 1pm to 3pm".  The fact that I can't easily process recurring
dates has been an ongoing problem.  After one of my partners posed a
question about recurring dates for another project a couple days ago, I
decided it was time to start thinking seriously about it.  The result is a
small module, recur.py, which you can get to through my Python Bits page at

    http://www.musi-cal.com/~skip/python/

The module implements a single class, Recurrence.  You can intersect two
recurrences to get a new one or generate a finite series of absolute dates
from an infinite recurrence.  It doesn't yet do unions (my feeble brain
hasn't figured that out), nor can it parse limited English phrases such as
the one above into a Recurrence object.  Also, it can only represent simple
recurrences.  More complex recurrences like "Easter", "every other Friday"
or "the third Thursday of the month" are beyond it.

Marc-Andre Lemburg's mxDateTime module:

    http://starship.python.net/crew/lemburg/mxDateTime.html

is required.

I'd very much like to get some feedback on this, especially on the stuff it
can't do.  It's an area where I have virtually no past programming
experience (literature references would be most welcome!).  If I'm hiking
down the wrong trail I'd like to find out before I run into a lot of grizzly
bears (or even the occasional snake... ;-)

Thanks,

Skip Montanaro	| http://www.mojam.com/
skip@mojam.com  | http://www.musi-cal.com/~skip/
847-971-7098

<P><A HREF="http://www.musi-cal.com/~skip/python/recur.py">recur.py</A> -
a Python class to handle recurring dates; needs mxDateTime
module.  (06-Aug-99)

-- 
----------- comp.lang.python.announce (moderated) ----------
Article Submission Address:  python-announce@python.org
Python Language Home Page:   http://www.python.org/
Python Quick Help Index:     http://www.python.org/Help.html
------------------------------------------------------------