Recurrent yearly date alert in Python

Posted by coulix on Stack Overflow See other posts from Stack Overflow or by coulix
Published on 2010-05-05T19:52:53Z Indexed on 2010/05/05 19:58 UTC
Read the original article Hit count: 201

Filed under:
|
|
|

Hello Hackerz,

Here is the idea

A user can set a day alert for a birthday. (We do not care about the year of birth) He also picks if he wants to be alerted 0, 1, 2, ou 7 days (Delta) before the D day. Users have a timezone setting.

I want the server to send the alerts at 8 am on the the D day - deleta +- user timezone

Example:

12 jun, with "alert me 3 days before" will give 9 of Jun.

My idea was to have a trigger_datetime extra field saved on the 'recurrent event' object. Like this a cron Job running every hour on my server will just check for all events matching irs current time hour, day and month and send to the alert.

The problem from a year to the next the trigger_date could change ! If the alert is set on 1st of March, with a one day delay that could be either 28 or 29 of February ..

Maybe i should not use the trigger date trick and use some other kind of scheme.

All plans are welcome.

© Stack Overflow or respective owner

Related posts about python

Related posts about algorithm