I think I've hit upon a fairly sane answer, although it makes the
internals of DateTime.pm even yuckier than before (which may be hard to
imagine if you've already poked around in some of the methods ;)
I've summarized it on the wiki here:
http://datetime.perl.org/wiki/index.cgi?MathProblems
Please read this and let me know what you all think. If you have
additional examples please just add them to the page, but it's probably
better to have the discussion here on the list (at least I'd prefer that).
I think it'll make most people happy, and I think it does a fairly good
job of being "intuitive".
However, it still does not make this set of equations always true:
$dt2 - $dt1 = $dur
$dt1 + $dur = $dt2
$dt2 - $dur = $dt1
The last line there may sometimes not be true in certain cases where the
first line's subtraction involves DST. I've managed to get it to the
point where this _only_ happens when $dt2 is the day of a DST transition.
Simply crossing the transition is ok.
I think this is about as good as I can get it without simply forcing lots
of additional complexity onto the user by adding many options to the API,
which I am loathe to do.
I'm hoping, however, that Rick will make sure that users can use
DT::F::Duration to handle anything that they cannot do with DateTime.pm
itself ;)
-dave
/*===================================================
VegGuide.Org www.BookIRead.com
Your guide to all that's veg. My book blog
===================================================*/