DateTime::Format::Natural currently does calculate its dates and times
with an initial DateTime object received by "DateTime->now" (with timezone
support). As a consequence thereof, many resulting final DateTime objects
within DateTime::Format::Natural will retain for units that have not been
altered the initial values.

Clayton L. Scott suggested to introduce a "date_only" option, which would
ignore (or reset) the time part for date-only strings. I intend to provide
the names of the units to reset through according metadata entries in the
grammar class. Later when post-processing data, the units would be resetted.

Some examples from the adjusted and yet unreleased tests:

 * 27/5/1979
     (without date_only: 27.05.1979 01:13:00) 
        (with date_only: 27.05.1979 00:00:00)
 * yesterday    
     (without date_only: 23.11.2006 01:13:08)
        (with date_only: 23.11.2006 00:00:00)
 * next hour
     (without date_only: 24.11.2006 02:13:08)
        (with date_only: 24.11.2006 02:00:00)
 * sunday 11:00 
     (without date_only: 26.11.2006 11:00:08) 
        (with date_only: 26.11.2006 11:00:00)

As mentioned above, I concur that it is worthwhile to implement (i.e.,
set the option per default and leave it open to the user to disable it),
but I'm a bit unsure that "date_only" is the most suitable name for this
new constructor option (given that it does not always reset just all time
components).

Suggestions and ideas welcome.

Thanks,

Reply via email to