I vote that you assume the next valid instance of the time (e.g. if
they say 4 o'clock and it is 11 PM now, assume 4AM of the following
day).

I believe this is what Date::Manip does and it seems to be reasonable
most of the time.

As another possibility (which is what I did with my obsolete version
of the ISO8601 parser) is to optionally take an arbitrary DT object to
use as the base and fall back to today otherwise.

I also returned additional items in array context, the first was the
DT object and the additional items described what was parsed so if the
person cared about time only in some cases they could tell them apart
from the fully specified items.

Additionally I allowed the user to tell the parser what formats were
valid.  I don't know if that is applicable in this parser though.

        -ben

On Mon, Jul 14, 2003 at 08:19:07AM +1000, Rick Measham wrote:
> I'm working with DateTime::Format::Natural and I really need a time-only
> object. In fact I need an object that lets me chose what I want to give
> it. 
> 
> For example: "It was 12 o'clock" - we know from this the hour, minute
> and second but have no idea of the day, month or year.
> 
> Also: "It was June 25" - no year, no time, but a valid date
> none-the-less. Sure there's some date math we can't do with it but we
> can still format it.
> 
> What should I do with these? Currently I'm returning 0000-01-01 00:00:00
> and subing in the parts I do know, but this is just wrong!
> 
> Cheers!
> Rick

Reply via email to