aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/date_and_time/zones.rb
diff options
context:
space:
mode:
authoramitkumarsuroliya <amitkumarsuroliya@gmail.com>2015-09-13 00:40:02 +0530
committeramitkumarsuroliya <amitkumarsuroliya@gmail.com>2015-09-13 00:49:20 +0530
commit7251533f78bf8410733fb71ffe514adfd2d74ebf (patch)
treea3c3807fb22d185ff257365610faea9d481d8efb /activesupport/lib/active_support/core_ext/date_and_time/zones.rb
parent33e7b3d9c1a5362d6739faa43796ffb6cec0d09c (diff)
downloadrails-7251533f78bf8410733fb71ffe514adfd2d74ebf.tar.gz
rails-7251533f78bf8410733fb71ffe514adfd2d74ebf.tar.bz2
rails-7251533f78bf8410733fb71ffe514adfd2d74ebf.zip
Improving `in_time_zone` docs [ci skip]
`DateTime.utc` is not a valid method. It gives `NoMethodError: undefined method `utc` for DateTime:Class`. As we know that we can calculate `utc` time from `Time` Class, but we can’t calculate `utc` time from `DateTime` Class.
Diffstat (limited to 'activesupport/lib/active_support/core_ext/date_and_time/zones.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/date_and_time/zones.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/date_and_time/zones.rb b/activesupport/lib/active_support/core_ext/date_and_time/zones.rb
index 96c6df9407..d29a8db5cf 100644
--- a/activesupport/lib/active_support/core_ext/date_and_time/zones.rb
+++ b/activesupport/lib/active_support/core_ext/date_and_time/zones.rb
@@ -4,7 +4,7 @@ module DateAndTime
# if Time.zone_default is set. Otherwise, it returns the current time.
#
# Time.zone = 'Hawaii' # => 'Hawaii'
- # DateTime.utc(2000).in_time_zone # => Fri, 31 Dec 1999 14:00:00 HST -10:00
+ # Time.utc(2000).in_time_zone # => Fri, 31 Dec 1999 14:00:00 HST -10:00
# Date.new(2000).in_time_zone # => Sat, 01 Jan 2000 00:00:00 HST -10:00
#
# This method is similar to Time#localtime, except that it uses <tt>Time.zone</tt> as the local zone
@@ -14,7 +14,6 @@ module DateAndTime
# and the conversion will be based on that zone instead of <tt>Time.zone</tt>.
#
# Time.utc(2000).in_time_zone('Alaska') # => Fri, 31 Dec 1999 15:00:00 AKST -09:00
- # DateTime.utc(2000).in_time_zone('Alaska') # => Fri, 31 Dec 1999 15:00:00 AKST -09:00
# Date.new(2000).in_time_zone('Alaska') # => Sat, 01 Jan 2000 00:00:00 AKST -09:00
def in_time_zone(zone = ::Time.zone)
time_zone = ::Time.find_zone! zone