aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/date
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-10-13 23:56:00 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-10-13 23:56:00 +0000
commit16796dc35f08ce567a0c4102b126527996c3b784 (patch)
tree5cb878a765788a5a7c405aff79a5fcff6c97ce20 /activesupport/lib/active_support/core_ext/date
parent389616e68d2b4f1f48014cf9d6d45754936c7bed (diff)
downloadrails-16796dc35f08ce567a0c4102b126527996c3b784.tar.gz
rails-16796dc35f08ce567a0c4102b126527996c3b784.tar.bz2
rails-16796dc35f08ce567a0c4102b126527996c3b784.zip
Time, Date and DateTime #advance accept :weeks option. Closes #9866.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7868 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/core_ext/date')
-rw-r--r--activesupport/lib/active_support/core_ext/date/calculations.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/date/calculations.rb b/activesupport/lib/active_support/core_ext/date/calculations.rb
index 9da7303f27..61db7e0f12 100644
--- a/activesupport/lib/active_support/core_ext/date/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/date/calculations.rb
@@ -68,11 +68,12 @@ module ActiveSupport #:nodoc:
end
# Provides precise Date calculations for years, months, and days. The +options+ parameter takes a hash with
- # any of these keys: :months, :days, :years.
+ # any of these keys: :years, :months, :weeks, :days.
def advance(options)
d = self
d = d >> options.delete(:years) * 12 if options[:years]
d = d >> options.delete(:months) if options[:months]
+ d = d + options.delete(:weeks) * 7 if options[:weeks]
d = d + options.delete(:days) if options[:days]
d
end