diff options
Diffstat (limited to 'activesupport/lib/active_support/values/time_zone.rb')
-rw-r--r-- | activesupport/lib/active_support/values/time_zone.rb | 8 |
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 |