aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorRoque Pinel <repinel@gmail.com>2015-07-19 11:08:20 -0400
committerRoque Pinel <repinel@gmail.com>2015-07-19 11:17:51 -0400
commit46b5b8ef40d81d583978fc7f111f0cd4ead26dfc (patch)
treef36bd095390c8f0c03006900692644b5d30c296c /activesupport/lib
parent3f1c5d39c01e13bcf9e34865f00ded56a3a321fc (diff)
downloadrails-46b5b8ef40d81d583978fc7f111f0cd4ead26dfc.tar.gz
rails-46b5b8ef40d81d583978fc7f111f0cd4ead26dfc.tar.bz2
rails-46b5b8ef40d81d583978fc7f111f0cd4ead26dfc.zip
Fix `TimeWithZone#eql?` to handle `TimeWithZone` created from `DateTime`
Before: ```ruby twz = DateTime.now.in_time_zone twz.eql?(twz.dup) => false ``` Now: ```ruby twz = DateTime.now.in_time_zone twz.eql?(twz.dup) => true ``` Please notice that this fix the `TimeWithZone` comparison to itself, not to `DateTime`. Based on #3725, `DateTime` should not be equal to `TimeWithZone`.
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/time_with_zone.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb
index 412c72d27c..f8f1b9ac2c 100644
--- a/activesupport/lib/active_support/time_with_zone.rb
+++ b/activesupport/lib/active_support/time_with_zone.rb
@@ -247,7 +247,7 @@ module ActiveSupport
end
def eql?(other)
- utc.eql?(other)
+ other.eql?(utc)
end
def hash