Neither came out the Rails 2.1 and was already found a serious error. Access the irb and try to run this:
Date.new(2008, 5, 31).end_of_quarter
Why? The implementation of the method end_of_quarter was made of the wrong way, it moves until the last month of the quarter and then picks last day. The problem is that it only moves the month, but as the date is starting on May 31, it’s trying to create a new instance of the Date to June 31, which does not exist. The class Time not raise an exception, but returns the wrong date: July 31.
In Edge Rails this has already been corrected, but who are using Rails 2.1 will have this problem.
Very careful, because this error only occurs if you use the method end_of_quarter in day 31 of May, July, and August. So, very careful.
For those who do not like to live dangerously by using the edge rails, I created a plugin with the code that fixes the bug. I will try to keep out this plugin updated whenever any corrections is released.
Do you like it? Recommend me on Working With Rails.