I said:
> > Looks good to me ... however for _standard_ subtraction I'd like it
> > stored the way I think about it:
> >
> > 2004-04-11 - 2003-04-20 = 1 year, -9 days.
> >
> > I know this breaks some of the internal logic so far as 'if one element
> > is negative, it's a negative duration', but I still think of the
> > difference in terms of the individual units.

Dave Rolsky replied:
> Hmm, that just seems a little too confusing.  It's a lot easier to explain
> that the difference will always be all negative or positive, and I think
> it makes it easier to work with.

What I just said looks confusing? Why? If I add 'one year minus nine days' to 
a particular datetime I know what I want to get back: I want it to be
a year later, less 9 days. That is, using today, 2004-10-03.

Now this is what is confusing:
print DateTime->new(year=>2003, month=>10, day=>12)
        ->add( years=>1, days=>-9 )->ymd
2002-10-03

Now why should a single negative in a duration be the deciding factor? 

Basically if a user sets a negative, it's a negative. If they set a positive it's
positive. You can't just make everything negative based on a single value.

Think about the way we talk. If I tell you it was my sister turned 25 a year ago 
tomorrow that would be (years => -1, days => +1); However DateTime::Duration currently 
returns 2002-10-11. But that sould be (years => -1, days => -1) and infact the two
return the same result!

So don't start telling me that my suggestion is a little too confusing.

Cheers!
Rick







Reply via email to