On Wed, 20 Feb 2008, Dr.Ruud wrote:
Maybe add a "safe => 1" (with new, add, subtract) such that the following don't die() anymore:
I'm not too keen on this, because it clutters up the API and puts too much burden on the end user to know about the possibility of "unsafe" datetime math.
Either the operations should be safe by default, or unsafe by default, in which case there should be a documented workaround.
In fact, the workaround is to convert the object to UTC before doing any math on it, which may or may not get the results you want.
Somewhat related: Maybe also add a newdate() that carries no time information.
You can effectively get this by simply using the floating time zone and never setting or altering any time components of the object.
If I had it to do all over again (which I guess I will if I work on this stuff for Perl 6), then I'd make a DateTime::Date class and simply use that class as part of DateTime::DateTime (err, names pending review).
-dave /*=================================================== VegGuide.Org www.BookIRead.com Your guide to all that's veg. My book blog ===================================================*/
