> The sub that generates recurrences can be 
responsible for truncation, right?

Right! I just found a way:

The callback receives a DateTime parameter. The 
callback must return 2 values: the value of the 
recurrence just before the date (that is, the 
truncated value), and the value of the recurrence 
after the date.

For example - a yearly recurrence:

$yearly_recurrence = DateTime::Set->new( 
  callback => sub {
    my $date = shift;
    return ( 
      $date->clone->truncate( 'year' ), 
      $date->clone->add( 'year' => 1 ) );
  }
}

This way, there is no need for 'start' or 'freq' 
parameters.

- Flavio Soibelmann Glock


Reply via email to