aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/time/calculations.rb
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2007-11-05 22:29:11 +0000
committerMichael Koziarski <michael@koziarski.com>2007-11-05 22:29:11 +0000
commit47576a646bd99d431f4217b20b7625bdd3444171 (patch)
tree1e2912a07b1cf0458ddc090c37c67001f124b7ee /activesupport/lib/active_support/core_ext/time/calculations.rb
parent800b69b6adab2e2ea90b66fd2b37ed05f973b1d5 (diff)
downloadrails-47576a646bd99d431f4217b20b7625bdd3444171.tar.gz
rails-47576a646bd99d431f4217b20b7625bdd3444171.tar.bz2
rails-47576a646bd99d431f4217b20b7625bdd3444171.zip
Cater for DST changes when converting Times to DateTimes. Closes #10068 [gbuesing]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8076 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/core_ext/time/calculations.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/time/calculations.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb
index 7f449aee49..19ac8f5a36 100644
--- a/activesupport/lib/active_support/core_ext/time/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/time/calculations.rb
@@ -35,7 +35,7 @@ module ActiveSupport #:nodoc:
def time_with_datetime_fallback(utc_or_local, year, month=1, day=1, hour=0, min=0, sec=0, usec=0)
::Time.send(utc_or_local, year, month, day, hour, min, sec, usec)
rescue
- offset = if utc_or_local.to_sym == :utc then 0 else ::DateTime.now.offset end
+ offset = utc_or_local.to_sym == :local ? ::DateTime.local_offset : 0
::DateTime.civil(year, month, day, hour, min, sec, offset, 0)
end