From 64fea9c45c515496bb60df4a1e141f44cac4d158 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 2 Jun 2008 22:02:43 -0500 Subject: Fixed Date#end_of_quarter to not blow up on May 31st [#289 state:resolved] (Danger) --- activesupport/lib/active_support/core_ext/date/calculations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib/active_support/core_ext') diff --git a/activesupport/lib/active_support/core_ext/date/calculations.rb b/activesupport/lib/active_support/core_ext/date/calculations.rb index 1e2dbf118e..b5180c9592 100644 --- a/activesupport/lib/active_support/core_ext/date/calculations.rb +++ b/activesupport/lib/active_support/core_ext/date/calculations.rb @@ -184,7 +184,7 @@ module ActiveSupport #:nodoc: # Returns a new Date/DateTime representing the end of the quarter (last day of march, june, september, december; DateTime objects will have time set to 23:59:59) def end_of_quarter - change(:month => [3, 6, 9, 12].detect { |m| m >= self.month }).end_of_month + beginning_of_month.change(:month => [3, 6, 9, 12].detect { |m| m >= self.month }).end_of_month end alias :at_end_of_quarter :end_of_quarter -- cgit v1.2.3