On Mon, Mar 10, 2008 at 07:42:21PM +0000, me said:
> 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?

So, adding this bit of code to the recur() method of 
DateTime::Event::ICal

   # dtstart / dtend / until
   if ($args{until}) {
        foreach my $meth (qw(second minute hour day month year)) {
            next unless $args{until}->$meth;
            foreach my $what (qw(dtstart dtend)) {
                $args{$what} = $args{$what}->truncate( to => $meth )
                    if exists $args{$what};
            }
            last;
        }
    }


gets the expected 5th result but I'm actually thing that it's the wrong 
way round and that the right answer is either

a) Tell people "Don't do that"

b) Work out what the highest precision is out of dtstart and until is  
and if dtstart is the highest make until be 

        += $highest_precision_unit - 1;

so in this case silently rewrite until from 

        20080331

to

        20080331T23:59:59

I'm not sure what to do with dtend - probably the same?


Simon


Reply via email to