diff options
author | Jon Moss <maclover7@users.noreply.github.com> | 2017-04-17 20:56:13 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-17 20:56:13 -0500 |
commit | a192e5f786aec68ff0b44187c339f9d94e831569 (patch) | |
tree | a01d06bd43df1dd5f0a13f13403279b9dabb4cec | |
parent | 0963aab728ab854bb6e45889cd45054b25a0cd4b (diff) | |
parent | 881def43e326c36a7870bcc3ba56dc4a006b9a38 (diff) | |
download | rails-a192e5f786aec68ff0b44187c339f9d94e831569.tar.gz rails-a192e5f786aec68ff0b44187c339f9d94e831569.tar.bz2 rails-a192e5f786aec68ff0b44187c339f9d94e831569.zip |
Merge pull request #28782 from kmayer/kmayer-doc-to-time
Add more explanation to to_time about timezones
-rw-r--r-- | activesupport/lib/active_support/core_ext/date/conversions.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/date/conversions.rb b/activesupport/lib/active_support/core_ext/date/conversions.rb index d553406dff..c6c30aa835 100644 --- a/activesupport/lib/active_support/core_ext/date/conversions.rb +++ b/activesupport/lib/active_support/core_ext/date/conversions.rb @@ -79,6 +79,9 @@ class Date # date.to_time(:local) # => 2007-11-10 00:00:00 0800 # # date.to_time(:utc) # => 2007-11-10 00:00:00 UTC + # + # NOTE: The :local timezone is Ruby's *process* timezone, i.e. ENV['TZ'] + # If the *application's* timezone is needed, then use +in_time_zone+ instead def to_time(form = :local) raise ArgumentError, "Expected :local or :utc, got #{form.inspect}." unless [:local, :utc].include?(form) ::Time.send(form, year, month, day) |