From 65d3430baf759c1b31cca4dde51b770804d8efbb Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 23 Feb 2005 23:55:59 +0000 Subject: 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 --- activesupport/lib/active_support/values/time_zone.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'activesupport') 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 -- cgit v1.2.3