aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/time_with_zone.rb
diff options
context:
space:
mode:
authorThomas Balthazar <thomas@balthazar.info>2016-09-23 14:03:48 +0200
committerThomas Balthazar <thomas@balthazar.info>2016-09-24 09:39:51 +0200
commit76c2553b8832c069793704c5d5629c534f782f88 (patch)
tree905c0104a3e5aa19ef4a0030c5050398ec9e3845 /activesupport/lib/active_support/time_with_zone.rb
parent0ce117fac3b9b0c58b3b6a091172d56754b56308 (diff)
downloadrails-76c2553b8832c069793704c5d5629c534f782f88.tar.gz
rails-76c2553b8832c069793704c5d5629c534f782f88.tar.bz2
rails-76c2553b8832c069793704c5d5629c534f782f88.zip
Fix ActiveSupport::TimeWithZone#in
Previously calls to `in` were being sent to the non-DST aware method `Time#since` via `method_missing`. It is now aliased to the DST aware `ActiveSupport::TimeWithZone#+` which handles transitions across DST boundaries, e.g: Time.zone = "US/Eastern" t = Time.zone.local(2016,11,6,1) # => Sun, 06 Nov 2016 01:00:00 EDT -05:00 t.in(1.hour) # => Sun, 06 Nov 2016 01:00:00 EST -05:00
Diffstat (limited to 'activesupport/lib/active_support/time_with_zone.rb')
-rw-r--r--activesupport/lib/active_support/time_with_zone.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb
index f7586efe6a..c35588fbae 100644
--- a/activesupport/lib/active_support/time_with_zone.rb
+++ b/activesupport/lib/active_support/time_with_zone.rb
@@ -279,6 +279,7 @@ module ActiveSupport
end
end
alias_method :since, :+
+ alias_method :in, :+
# Returns a new TimeWithZone object that represents the difference between
# the current object's time and the +other+ time.