James Herdman
4/12/2006 6:52:00 PM
On 2006-04-12 14:37:01 -0400, "ChrisH" <chris.hulan@gmail.com> said:
>
> Dan wrote:
>> Firstly, thanks for all the responses! I guess I should have been more
>> clear in my initial post. d is a Date object. The goal of the
>> function is to return a Date object for the same day in the next month.
>> For example, 2006-03-25 would become 2006-04-25. The while loop is
>> there to handle dates like 2006-01-31, which would need to become
>> 2006-02-28 since there is no 31st in Feb.
>>
>> Dan
>
> If you look at the docs you'll see that next_month (or >>) already
> adjust for months with differing end days.
>
> One caveat, I guess next_month is a new method as it doesn't exist in
> my install. >> works as described, and you can implement next_month,
> or just gert the lates Date lib.
>
> Cheers
I have Date#>> in my install -- Ruby 1.8.4. It definitely solves the
problem =)
James H.