aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/values
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-02-23 23:55:59 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-02-23 23:55:59 +0000
commit65d3430baf759c1b31cca4dde51b770804d8efbb (patch)
treeb96b72e6ab4939eb0d6faff67d5bfabd5fc5fbfe /activesupport/lib/active_support/values
parent11a2bb91f5153ab408ba7bd7a58948334729997b (diff)
downloadrails-65d3430baf759c1b31cca4dde51b770804d8efbb.tar.gz
rails-65d3430baf759c1b31cca4dde51b770804d8efbb.tar.bz2
rails-65d3430baf759c1b31cca4dde51b770804d8efbb.zip
Fixed TimeZone issues in action-pack and active-support #704
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@776 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/values')
-rw-r--r--activesupport/lib/active_support/values/time_zone.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb
index 7766727a40..3f524c4759 100644
--- a/activesupport/lib/active_support/values/time_zone.rb
+++ b/activesupport/lib/active_support/values/time_zone.rb
@@ -37,8 +37,14 @@ class TimeZone
adjust(Time.now)
end
+ # Return the current date in this time zone.
+ def today
+ now.to_date
+ end
+
# Adjust the given time to the time zone represented by +self+.
def adjust(time)
+ time = time.to_time
offset = time.utc_offset
time + utc_offset - offset
end
@@ -152,4 +158,4 @@ class TimeZone
all.find_all { |z| z.name =~ US_ZONES }
end
end
-end \ No newline at end of file
+end