dateutil and dates before today

D

dmbkiwi

I'm using the dateutil module from http://labix.org/python-dateutil.

Am I right in thinking that the rrules module doesn't acknowledge days
before today?

An example of the issue:
rule_temp = rrule(YEARLY,bymonth=1,bymonthday=1)
print rule_temp.between(datetime(2006,12,1),datetime(2007,1,4),True) [datetime.datetime(2007, 1, 1, 19, 21, 29)]
print rule_temp.between(datetime(2005,12,1),datetime(2006,1,4),True) []
print rule_temp.between(datetime(2005,12,1),datetime(2007,1,4),True) [datetime.datetime(2007, 1, 1, 19, 21, 29)]
print rule_temp.before(datetime.today(),True) None
print rule_temp.after(datetime.today(),True)
2007-01-01 19:21:29

Basically, it doesn't seem to acknowledge any dates before today. Is
this right?

Cheers

Matt
 
D

dmbkiwi

I'll answer my own post.

If you don't specify dtstart, it defaults to datetime.today().
Therefore, there are no instances before today. Specify dtstart as a
historic date, and it works on any dates after dtstart.

Wish I'd engaged brain before posting.

Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top