The documentation on D::E::Recurrence isn't helping me much. What am I doing wrong here?

my $dt_start = DateTime->new( year => 2007,
  month => 1, day => 15, hour => 11);

my $daily_at_10_30 = DateTime::Event::Recurrence->daily(hours => 10,
  minutes => 30);

for(my $i = 0; $i < 5; $i++)
{
   print $daily_at_10_30->next($dt_start)->datetime . "\n";
}

I'm expecting output like this:

2007-01-16T10:30:00
2007-01-17T10:30:00
2007-01-18T10:30:00
2007-01-19T10:30:00
2007-01-20T10:30:00

But getting this:

2007-01-16T10:30:00
2007-01-16T10:30:00
2007-01-16T10:30:00
2007-01-16T10:30:00
2007-01-16T10:30:00

Eventually what I will need to do is compare the ->next recurrence with the current (local) datetime and if the ->next is less than that, get next recurrence. But at this point, I can't even get simple recurrence to occur.

Thanks,
-Matthew

Rick Measham wrote:
Matthew wrote:
Hey guys,
Does anyone have, already made, some type of "recurring events" module? We have our in-house function that works with singular weekly and singular monthly events but we'd like to branch into daily, bi-daily, bi-weekly, bi-monthly, every X weeks, every X days, etc.

Like DateTime::Event::Recurrence?

my $bi_daily_at_10_30am_set = DateTime::Event::Recurrence->daily(
   interval => 2,
   hours => 10,
   minutes => 30
);

http://search.cpan.org/dist/DateTime-Event-Recurrence/lib/DateTime/Event/Recurrence.pm

Cheers!
Rick Measham

Reply via email to