Dave Rolsky wrote:
> Looking at the code this seems to be based on the highly dubious
> assumption that no two dates produced by a recurrnce could be great than
> 13 months apart.
> What if you recurrnce is "once every century"?

I was actually going to rewrite that part.
The new idea was, it would generate two "samples", then use the
date-difference
as an initial guess. 

> I think to do recurrences that move backwards in time we have to
> explicitly tell the user to provide a callback that moves backwards, which
> would mean providing _two_ callbacks if they wanted to be able to move in
> both directions.
> Honestly, I don't think it's worth the API complication this requires.
> Just let the user provide one callback, and maybe specify a directory for
> it.  

You mean, specify a DateTime::Event:xxx class?
 
> Then the "next()" method can return the next date in the recurrence,
> which may be earlier or later than the last one returned.

Maybe with this interface ?

$set = new DateTime::Set (
    next => \&next_callback,
    previous => \&prev_callback,
    start => $dt1,
    end => $dt2,
);

$set = new DateTime::Set (
    from_event => 'DateTime::Event::Easter',
    start => $dt1,
    end => $dt2,
);

"previous", "start", "end" are be optional.
If you don't provide "previous", it would be guessed out from "next" (?)

- Flavio S. Glock

Reply via email to