Skip to content

Ensure expansion-range of recurring events includes today/now #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
noctux opened this issue Nov 29, 2014 · 2 comments
Closed

Ensure expansion-range of recurring events includes today/now #135

noctux opened this issue Nov 29, 2014 · 2 comments

Comments

@noctux
Copy link

noctux commented Nov 29, 2014

I'm syncing a contacts-birthday calendar with vdirsyncer and am trying to use that with khal. An example VEVENT looks like this:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//ownCloud//NONSGML Contacts 0.3.0.17//EN
BEGIN:VEVENT
DTSTART;VALUE=DATE:19650423
DURATION:P1D
UID:badf00d0-0000-0000-0000-000000000000
RRULE:FREQ=YEARLY
SUMMARY:Dummy's Birthday (1965)
END:VEVENT
END:VCALENDAR

However, the event is not displayed for the 23.04.2014 (or 2015). I did experiment a bit with the event (the code for _get_vevent() is taken from khalendar_aux_test.py):

Python 2.7.8 (default, Sep 24 2014, 18:26:21) 
[GCC 4.9.1 20140903 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> import pytz
>>> import icalendar
>>> from khal.khalendar import aux
>>> event_test = """BEGIN:VCALENDAR
... VERSION:2.0
... PRODID:-//ownCloud//NONSGML Contacts 0.3.0.17//EN
... BEGIN:VEVENT
... DTSTART;VALUE=DATE:19650423
... DURATION:P1D
... UID:badf00d0-0000-0000-0000-000000000000
... RRULE:FREQ=YEARLY
... SUMMARY:Dummy's Birthday (1965)
... END:VEVENT
... END:VCALENDAR"""
>>> def _get_vevent(event):
...     ical = icalendar.Event.from_ical(event)
...     for component in ical.walk():
...         if component.name == 'VEVENT':
...             return component
... 
>>> vev = _get_vevent(event_test)
>>> berlin = pytz.timezone('Europe/Berlin')
>>> aux.expand(vev, berlin)
[(datetime.date(1965, 4, 23), datetime.date(1965, 4, 24)), (datetime.date(1966, 4, 23), datetime.date(1966, 4, 24)), (datetime.date(1967, 4, 23), datetime.date(1967, 4, 24)), (datetime.date(1968, 4, 23), datetime.date(1968, 4, 24)), (datetime.date(1969, 4, 23), datetime.date(1969, 4, 24)), (datetime.date(1970, 4, 23), datetime.date(1970, 4, 24)), (datetime.date(1971, 4, 23), datetime.date(1971, 4, 24)), (datetime.date(1972, 4, 23), datetime.date(1972, 4, 24)), (datetime.date(1973, 4, 23), datetime.date(1973, 4, 24)), (datetime.date(1974, 4, 23), datetime.date(1974, 4, 24)), (datetime.date(1975, 4, 23), datetime.date(1975, 4, 24)), (datetime.date(1976, 4, 23), datetime.date(1976, 4, 24)), (datetime.date(1977, 4, 23), datetime.date(1977, 4, 24)), (datetime.date(1978, 4, 23), datetime.date(1978, 4, 24)), (datetime.date(1979, 4, 23), datetime.date(1979, 4, 24))]
>>> len(aux.expand(vev, berlin))
15

which fits the bill with the comment in aux.py:65:

            # rrule really doesn't like to calculate all recurrences until
            # eternity, so we only do it 15 years into the future

So if that is the acutal source of the issue, it might be desireable to calculate +/- Y years around the current year in expand aswell.

Regards,
Simon

@untitaker
Copy link
Member

This is something we'll have to take care of with #118.

@untitaker
Copy link
Member

Keeping this open as a reminder.

@geier geier added the type: bug label Dec 2, 2014
@geier geier closed this as completed in 7d140aa Dec 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants