Skip Menu |

This queue is for tickets about the DateTime-Format-Natural CPAN distribution.

Report information
The Basics
Id: 29068
Status: resolved
Priority: 0/
Queue: DateTime-Format-Natural

People
Owner: Nobody in particular
Requestors: jesse [...] bestpractical.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: prefer_future gives bogus results if the original result would have been in the future.
Date: Thu, 30 Aug 2007 12:12:11 -0400
To: bug-datetime-format-natural [...] rt.cpan.org
From: Jesse Vincent <jesse [...] bestpractical.com>
DB<5> $parser = DateTime::Format::Natural->new( prefer_future => 0); DB<6> $dt = $parser->parse_datetime('Saturday'); DB<7> print $dt; 2007-09-01T16:05:36 DB<8> $parser = DateTime::Format::Natural->new( prefer_future => 1); DB<9> $dt = $parser->parse_datetime('Saturday'); DB<10> print $dt; 2007-09-08T16:11:33 DB<11> print DateTime->now 2007-08-30T16:11:46 DB<12>
Download PGP.sig
application/pgp-signature 186b

Message body not shown because it is not plain text.

From: SCHUBIGER [...] cpan.org
On Do. 30. Aug. 2007, 12:12:27, jesse@bestpractical.com wrote: Show quoted text
> DB<5> $parser = DateTime::Format::Natural->new( prefer_future => 0); > DB<6> $dt = $parser->parse_datetime('Saturday'); > DB<7> print $dt; > 2007-09-01T16:05:36 > DB<8> $parser = DateTime::Format::Natural->new( prefer_future => 1); > DB<9> $dt = $parser->parse_datetime('Saturday'); > DB<10> print $dt; > 2007-09-08T16:11:33
Am I right assuming, that you expected 2007-09-01 here too? Show quoted text
> DB<11> print DateTime->now > 2007-08-30T16:11:46 >
DB<12>
Subject: Re: [rt.cpan.org #29068] prefer_future gives bogus results if the original result would have been in the future.
Date: Thu, 30 Aug 2007 14:50:36 -0400
To: bug-DateTime-Format-Natural [...] rt.cpan.org
From: Jesse Vincent <jesse [...] bestpractical.com>
On Aug 30, 2007, at 2:47 PM, via RT wrote: Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=29068 > > > On Do. 30. Aug. 2007, 12:12:27, jesse@bestpractical.com wrote: >
>> DB<5> $parser = DateTime::Format::Natural->new( prefer_future => 0); >> DB<6> $dt = $parser->parse_datetime('Saturday'); >> DB<7> print $dt; >> 2007-09-01T16:05:36 >> DB<8> $parser = DateTime::Format::Natural->new( prefer_future => 1); >> DB<9> $dt = $parser->parse_datetime('Saturday'); >> DB<10> print $dt; >> 2007-09-08T16:11:33
> > Am I right assuming, that you expected 2007-09-01 here too?
You are. Sorry for the terse bug report. Basically, I'd expect that "prefer future" would make 'Saturday' parse as the next saturday to happen after $now, not "do a parse, then add one $timeunit" Does that seem sane? -jesse Show quoted text
>> DB<11> print DateTime->now >> 2007-08-30T16:11:46 >>
> DB<12> > > >
Download PGP.sig
application/pgp-signature 186b

Message body not shown because it is not plain text.

On Do. 30. Aug. 2007, 14:50:47, jesse@bestpractical.com wrote: Show quoted text
> Basically, I'd expect that "prefer future" would make 'Saturday' > parse as the next saturday to happen after $now, not "do a parse, > then add one $timeunit" > > Does that seem sane?
Yes (saner than the approach suggested before by someone else). Please mail me offhand so that we're able to sort out the specifics. You even might be able to short-circuit with the person who suggested this current approach.
Resolved as of v0.55.