David Wheeler wrote:
The normalization stuff in DateTime::Format::Duration gets us part of
the way there, but not quite, as if I say, "23 hours, 90 minutes", it
will return "24 hours 29 minutes", which is not quite the same as what
was initially specified.
That's probably as close as you can get ..
At any rate, does this make sense to folks? If so, I'd be willing to
hack something into DateTime::Duration to support this. Comments?
The problem with this is that you'd really want to use something other
than DateTime::Duration as DT:D is designed for Date math.
DT:D Proposal
(11 hours, 90 minutes) 750m 11h 90m
+
(32 minutes) 32m 32m
=
782m 11h 122m
* 2 1564m 22h 244m
...
The more we do, the more confusing your proposed method gets. Sure you
could keep it separate inside DT:D but then you'll have to do the math
for both the current and the proposed values every time.
I'd be thinking of just storing the values as a hash(ref) that you later
feed back into DT:D when you need to. That way you can store it however
you need to.
(Personally, I'd be happy as a user if I asked for 90m if it returned
1h30m .. but I imagine different things need different units)
Cheers!
Rick Measham