aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/time_with_zone.rb
diff options
context:
space:
mode:
authorMatthew Stopa <matthew.p.stopa@gmail.com>2012-12-31 19:04:10 -0700
committerMatthew Stopa <matthew.p.stopa@gmail.com>2012-12-31 19:05:59 -0700
commit6d5385a1354a8bec2ac522693c1173e547ffd61e (patch)
treeb790fae8a454e2f49c33733f9125aa77e3c44dcb /activesupport/lib/active_support/time_with_zone.rb
parent3511e3f449357107f9599549438147b2cadbb8e1 (diff)
downloadrails-6d5385a1354a8bec2ac522693c1173e547ffd61e.tar.gz
rails-6d5385a1354a8bec2ac522693c1173e547ffd61e.tar.bz2
rails-6d5385a1354a8bec2ac522693c1173e547ffd61e.zip
Add documentation for the TimeWithZone#dst? method.
[ci skip]
Diffstat (limited to 'activesupport/lib/active_support/time_with_zone.rb')
-rw-r--r--activesupport/lib/active_support/time_with_zone.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb
index 0dbc198ea2..89f37114fd 100644
--- a/activesupport/lib/active_support/time_with_zone.rb
+++ b/activesupport/lib/active_support/time_with_zone.rb
@@ -80,6 +80,12 @@ module ActiveSupport
end
alias_method :getlocal, :localtime
+ # Returns true if the the current time is within Daylight Savings Time for the
+ # specified time zone.
+ #
+ # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
+ # Time.zone.parse("2012-5-30").dst? # => true
+ # Time.zone.parse("2012-11-30").dst? # => false
def dst?
period.dst?
end