Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: clscott [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.75
Fixed in: 0.75



Subject: An option to set time to 0hrs if the string to parse includes only a date
I'd like an option to set the time part of the DateTime time to 0hrs if the string to parse includes only a date or ignore times altogether. Ex: $parser = DateTime::Format::Natural->new( date_only => 1, ); Would this be difficult? Again I'm willing to patch if there's a public repo.
On Fri Feb 20 09:26:19 2009, CLSCOTT wrote: Show quoted text
> Would this be difficult?
If I understand you correctly, no. Assuming you want to see both kind of dates supported, formatted (e.g., 10/03/2009) and natural (e.g., 10 March) ones, we could base the logic upon the "modified" counter values which keep track how often units have been altered by according DateTime setter methods. However, some further examples (i.e., what should and what should not work) would be still appreciated.
On Tue Mar 10 17:54:19 2009, SCHUBIGER wrote: Show quoted text
> However, some further examples (i.e., what should and what should not > work) would be still appreciated.
I would expect the following datetimes to not have a time component when this option is enabled ( and possibly by default ): 03/10/2009 Feb 28, 2009 last Thursday in April last Thursday I would expect the following datetimes to have a time set since there is a time component to be parsed out: noon last friday 1am next thursday Feb 28 3pm
As of v0.76_01 truncating is done per default where appropriate. This design choice has been strongly emphasized within <http://www.mail-archive.com/datetime@perl.org/msg06374.html>. Regarding your example inputs: shall they be supported?
Support added for unsupported examples in v0.77_01.