On Sun, 23 Mar 2003, Rick Measham wrote:

> My $0.02 on the event suite would be:
>
> ($dt is DateTime object for something like Sept 1, 2002)
>
> $dt4jul = DateTime::Event::FourthJuly::next($dt)
> #20030704
>
> $dt4jul = DateTime::Event::FourthJuly::previous($dt)
> #20020704
>
> $dt4jul = DateTime::Event::FourthJuly::closest($dt)
> #20020704

This looks like a good proposal.

> My question is .. should they return midnight? If its noon on the 4th
> July and we ask for 'next' or 'set' do we include the current?
> Probably not. But if we return midnight, does 'previous' return the
> current? Really shouldn't.

I think it returns midnight _but_ next or previous or whatnot will only
look at the _date_ of the datetime object given, at least for events that
are "date events", as opposed to something like DateTime::Event::Sunrise,
which is indeed a date _and_ time event.

> What does a multi-day event return? For example, we could use the
> timezone to determine 'season' .. does previous return the last day
> of the previous season? Does 'next' return the first of the next ...

A multi-day event could return _either_ DateTime::Span object (if it lasts
from day 1 through day X) _or_ a DateTime::SpanSet object if it's
something even more complex like Hanukah, which (if I remember correctly)
is really 8 _evenings_.  Simiarly, I believe Ramadan's fasting rules are
only in effect during the day, so it might be useful to be able to ask for
the fasting spans.

Anyway, for really funky stuff it'll probably need a more complex API,
because for something like Hanukah we still want to be able to ask "what
is the next start day of Hanukah" as well as more complex things like
"given me a set of all the sunrises during Hanukah so I know when to light
the candles".

In other words, I think for many things we can have a generic API (next,
previous, closest) but for others they'll have to just use that as
inspiration.


-dave

/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/

Reply via email to