提交 4bec1da7 编写于 作者: V Vipul A M

Remove deprecated `Date#to_time_in_current_zone`

上级 9aaa3111
* Remove deprecated `Date#to_time_in_current_zone` in favour of `Date#in_time_zone`.
*Vipul A M*
* Remove deprecated `Proc#bind` with no replacement. * Remove deprecated `Proc#bind` with no replacement.
*Carlos Antonio da Silva* *Carlos Antonio da Silva*
......
...@@ -2,21 +2,6 @@ ...@@ -2,21 +2,6 @@
require 'active_support/core_ext/time/zones' require 'active_support/core_ext/time/zones'
class Date class Date
# *DEPRECATED*: Use +Date#in_time_zone+ instead.
#
# Converts Date to a TimeWithZone in the current zone if <tt>Time.zone</tt> or
# <tt>Time.zone_default</tt> is set, otherwise converts Date to a Time via
# Date#to_time.
def to_time_in_current_zone
ActiveSupport::Deprecation.warn 'Date#to_time_in_current_zone is deprecated. Use Date#in_time_zone instead', caller
if ::Time.zone
::Time.zone.local(year, month, day)
else
to_time
end
end
# Converts Date to a TimeWithZone in the current zone if Time.zone or Time.zone_default # Converts Date to a TimeWithZone in the current zone if Time.zone or Time.zone_default
# is set, otherwise converts Date to a Time via Date#to_time # is set, otherwise converts Date to a Time via Date#to_time
# #
......
...@@ -363,10 +363,3 @@ def test_can_freeze_twice ...@@ -363,10 +363,3 @@ def test_can_freeze_twice
end end
end end
class DateExtConversionsTest < ActiveSupport::TestCase
def test_to_time_in_current_zone_is_deprecated
assert_deprecated(/to_time_in_current_zone/) do
Date.new(2012,6,7).to_time_in_current_zone
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册