I would also mention that, at least this year, there are timezones such as in Egypt that have no time 00:00:00 on the day when the clocks move ahead - their timezone definition goes from 23:59:59 to 01:00:00 on that day.

Steven Schubiger wrote:
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,

--
Shane P. McCarron                          Phone: +1 763 786-8160 x120
Managing Director                            Fax: +1 763 786-8180
ApTest Minnesota                            Inet: sh...@aptest.com


Reply via email to