kvh / recurrent

Natural language parsing of dates and recurring events
MIT License
249 stars 30 forks source link

RFC compliance issue that breaks timeutil.rrule #1

Closed arikb closed 11 years ago

arikb commented 11 years ago

Hello kvh,

This is the code sample I'm working with:

from dateutil import rrule
from recurrent import RecurringEvent
from datetime import datetime, timedelta

line = raw_input('--> ')

recur_evt = RecurringEvent()
interval_spec = recur_evt.parse(line)
print "Interval spec:", interval_spec
print "RFC:", recur_evt.get_RFC_rrule()

rec_rule = rrule.rrulestr(recur_evt.get_RFC_rrule())

print rec_rule.between(datetime.now(),datetime.now()+timedelta(days=10),inc=True)

When parsing the following:

daily at 3pm

the resulting RFC rrule is:

RRULE:BYMINUTE=NONE;FREQ=DAILY;BYHOUR=15;INTERVAL=1

while the following:

daily at 3:00pm

results in:

RRULE:BYMINUTE=00;FREQ=DAILY;BYHOUR=15;INTERVAL=1

The former breaks rrule while the latter doesn't. The error is:

ValueError: invalid 'BYMINUTE': NONE

I checked the RFC 5545 and it requires digits following the '=' and doesn't accept anything other than a digit or two.

I'll look further into this attempting to fix it myself too.

kvh commented 11 years ago

Thanks for the report