On 1/26/11 10:13 AM, "David Steinbrunner" <[email protected]> wrote:
>The results cycle from 0 to 30 rather than simply going from 0 to 100 as
>I
>would expect. When I look back at the docs I see confirmation of my
>expectations with the following example:
>
>$dur->in_units( 'months' ); # 27
>
>This shows that years, which is a greater increment, is not interfering
>with the results as in the case with months and days in my example. To
>confirm the example in the docs all you have to do it change the two
>occurrences of "days" in my example code to "months" and you will find
>the
>results to be 0 through 100.
>
>So are my expectations incorrect or is this a bug? If this is not a bug,
>is there a way to just get the days that I'm not seeing?
Ok, a little more digging has been done so I'll follow up.
So I started thinking about how just calling the ->days method returns
days limited by week. I don¹t have the in my code example but all you
have to do is add a print to $duration->days in there to see what I mean.
This got me thinking about weeks and what is done for it compared to days
and months. It turns out the results of ->in_units('weeks') and ->weeks
is exactly the same, 0 through 3.
So when calling ->months, ->weeks or ->days you get results limited to the
next highest interval but when using in_units for the same intervals each
has a different type of result.
Months: Not limited
Weeks: Limited but the next interval (months)
Days: Limited by two intervals (months)
Of course, the pattern here is that each of these are limited by months
but limiting months by months gives you the "right" answer so there is no
issue.
So that is it for now. I'm assuming this is a bug but I'd appreciate
someone confirming my assumption.
--
David Steinbrunner