Bug in DateTime::Format::ICal parse_recurrence?

[email protected] (Simon Wistow)
Newsgroups perl.datetime
Message-ID <[email protected]>
I'm not sure if this is me being dumb or whether it's an actual bug.

Given this code

use strict;
use DateTime;
use DateTime::Format::ICal;

my $hour  = shift || 0;
my $start = DateTime->new(year => 2008, month => 3, day => 1);
   $start->set( hour => 18 ) if $hour;
my $recur = DateTime::Format::ICal->parse_recurrence(
                recurrence => "FREQ=WEEKLY;BYDAY=MO;UNTIL=20080331",
                dtstart => $start
);



my $iter = $recur->iterator;
while ( my $dt = $iter->next) {
        print "  ".$dt->ymd."\n";
};


I would expect to get the 5 mondays in March on the 3rd, 10th, 17th, 
24th and 31st and if you run it without passing a command line argument 
then that's what you get.

However, if you run it as ./script 1 then you don't get the final 
occurrence on the 31st.

I'm guessing it's the mismatch between the precision of the UNTIL and 
the $start - should something (either DateTime::Format::ICal, 
DateTime::Event::ICal or my code) truncate the $start to the same 
precision as the UNTIL?

Thanks,

Simon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.