aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/time/calculations.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/core_ext/time/calculations.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/time/calculations.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb
index 94d660afbd..d594cf21f9 100644
--- a/activesupport/lib/active_support/core_ext/time/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/time/calculations.rb
@@ -110,12 +110,12 @@ module ActiveSupport #:nodoc:
# Returns a new Time representing the time a number of specified years ago
def years_ago(years)
- change(:year => self.year - years)
+ advance(:years => -years)
end
# Returns a new Time representing the time a number of specified years in the future
def years_since(years)
- change(:year => self.year + years)
+ advance(:years => years)
end
# Short-hand for years_ago(1)