On 06-09-29, at 08:59, Matthew Harris wrote:

> On 9/29/06, Tanner Burson <tanner.burson / gmail.com> wrote:
>> You mention that it can convert number of days/weeks into months.   
>> How do
>> you deal with the fact that a "month" doesn't have a standard  
>> number of
>> days?  Do you do as the Rails extension does by assuming a fixed  
>> number, or
>> some other form of trickery?
>
> Since durations are only based on timespans of fixed lengths, they do
> not work relatively. So there is no time-detection magic to determine
> the days in a given month, because also durations don't distinguish
> between what month it is (whether it be January or Feburary).
> BigDuration, the class that supports years and months will assume 30
> days as 1 month, and 12 months as 1 year.

Just to add a little bit here, in Io, our Duration module doesn't  
know anything about months at the moment, instead adding up days. It  
could keep a list holding the number of days in a month (in the case  
of february, if a leap year is detected, replace the second item in  
the list (28) with 29). Now that extension is pretty easy, but right  
now we only keep track of years, days, hours, and so on. You might  
consider doing something similar. It's fairly straight forward.

Also, out of curiosity, why have two Duration classes? I can't see  
how BigDuration would be required, perhaps could you elaborate a little?

> Matt

--
Jeremy Tregunna
jtregunna / blurgle.ca