diff options
author | gbuesing <gbuesing@gmail.com> | 2008-05-18 11:15:29 -0500 |
---|---|---|
committer | gbuesing <gbuesing@gmail.com> | 2008-05-18 11:15:29 -0500 |
commit | cde9c09a524a21214ea9cd0f9ee4489e4d185af2 (patch) | |
tree | f3f5e90e0c3e85602c74417b80391dbe2eeea706 /activesupport/lib | |
parent | e30a263bf1744d0b55d073c7d1087d0d64181d2c (diff) | |
download | rails-cde9c09a524a21214ea9cd0f9ee4489e4d185af2.tar.gz rails-cde9c09a524a21214ea9cd0f9ee4489e4d185af2.tar.bz2 rails-cde9c09a524a21214ea9cd0f9ee4489e4d185af2.zip |
TimeWithZone #+ and #- : ensure overflow to DateTime with Numeric arg
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/time_with_zone.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index 48606dbcff..15145a2575 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -135,7 +135,7 @@ module ActiveSupport # If wrapped #time is a DateTime, use DateTime#since instead of #+ # Otherwise, just pass on to #method_missing def +(other) - result = utc.acts_like?(:date) ? utc.since(other) : utc + other + result = utc.acts_like?(:date) ? utc.since(other) : utc + other rescue utc.since(other) result.in_time_zone(time_zone) end @@ -146,7 +146,7 @@ module ActiveSupport if other.acts_like?(:time) utc - other else - result = utc.acts_like?(:date) ? utc.ago(other) : utc - other + result = utc.acts_like?(:date) ? utc.ago(other) : utc - other rescue utc.ago(other) result.in_time_zone(time_zone) end end |