Dave Rolsky wrote:
truncate( to='month' ) is setting the month to 1. I think it should
only do that if I asked to truncate to 'year', isn't it? Or maybe I'm
doing something wrong.
I guess this depends on your expectations. What do others think? Does
truncating to the month include the month
On Thu, 13 Mar 2003 [EMAIL PROTECTED] wrote:
Dave wrote:
In pseudo-code, I'd do ...
I'm writing some code to test it.
It works!
..-new(
recurrence = sub { ... },
start = optional,
end = optional,
}
should I commit this?
Sure, go for it.
-dave
I propose
DateTime::Set-new( recurrence = $string
);
where $string is any of the parameters
accepted by both DateTime::truncate() and
DateTime::add(), such as 'day', 'year'.
If somebody really wants other recurrences,
they could create their own
DateTime-derived class and override
Why does the DateTime::Set class need to get both
dates back? I think that's what is confusing me.
Another option: the callback receives a start date
and an end date parameters, and it returns the list
of the dates that are in that time span. This looks
much simpler, and it solves the
On Fri, 7 Mar 2003, fglock wrote:
Although $recurr_months was defined as start=NEG_INFINITY,
the equation solver inside Set::Infinite will substitute
that for start=20030201. Otherwise it would not find
an answer.
The 20030201 value is found by applying a truncation on
the 20030205 value.
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
On Mon, 10 Mar 2003 [EMAIL PROTECTED] wrote:
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:
Oops. There was an error in my example, I didn't
truncate the second return value.
Why does the DateTime::Set class need to get both
dates back? I think that's what is confusing me.
It needs 'random access' to the recurrence, such that
it can construct the set of ocurrences for a
Dave Rolsky wrote:
The level of truncation needed can be calculated
pretty easily.
Yes, if I have a recurrence string (like RFC2445
recurrences).
But I don't see how to calculate it from a piece of
callback code that could be specifying things so
widely variable, from milliseconds up
Dave Rolsky wrote:
you're using methods from Set::Infinite that are either
under-documented or not documented at all.
It would have been too difficult to write those
functions whithout using some low-level code.
Maybe I should include an INTERNALS section in Set::Infinite pod,
to help other
10 matches
Mail list logo