aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/date
diff options
context:
space:
mode:
authorJosh Kalderimis <josh.kalderimis@gmail.com>2011-02-27 20:24:39 +0100
committerJeremy Kemper <jeremy@bitsweat.net>2011-02-28 14:05:49 -0800
commit0f8d2794f229175447163d2b5e16d94d2cee5468 (patch)
treeef64056364232df6c68ce12581ef09f1bdaed5ce /activesupport/lib/active_support/core_ext/date
parentde9713186d693652deed22cff121b43317e86ef0 (diff)
downloadrails-0f8d2794f229175447163d2b5e16d94d2cee5468.tar.gz
rails-0f8d2794f229175447163d2b5e16d94d2cee5468.tar.bz2
rails-0f8d2794f229175447163d2b5e16d94d2cee5468.zip
updated Time, Date and DateTime current methods in AS to use Time.zone and not Time.zone_default.
[#6410 state:committed]
Diffstat (limited to 'activesupport/lib/active_support/core_ext/date')
-rw-r--r--activesupport/lib/active_support/core_ext/date/calculations.rb4
-rw-r--r--activesupport/lib/active_support/core_ext/date/zones.rb6
2 files changed, 5 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/core_ext/date/calculations.rb b/activesupport/lib/active_support/core_ext/date/calculations.rb
index f34185f22c..724e076407 100644
--- a/activesupport/lib/active_support/core_ext/date/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/date/calculations.rb
@@ -36,9 +36,9 @@ class Date
::Date.current.tomorrow
end
- # Returns Time.zone.today when config.time_zone is set, otherwise just returns Date.today.
+ # Returns Time.zone.today when <tt>Time.zone</tt> or <tt>config.time_zone</tt> are set, otherwise just returns Date.today.
def current
- ::Time.zone_default ? ::Time.zone.today : ::Date.today
+ ::Time.zone ? ::Time.zone.today : ::Date.today
end
end
diff --git a/activesupport/lib/active_support/core_ext/date/zones.rb b/activesupport/lib/active_support/core_ext/date/zones.rb
index 3a83af6be2..a70b47b7bc 100644
--- a/activesupport/lib/active_support/core_ext/date/zones.rb
+++ b/activesupport/lib/active_support/core_ext/date/zones.rb
@@ -2,10 +2,10 @@ require 'date'
require 'active_support/core_ext/time/zones'
class Date
- # Converts Date to a TimeWithZone in the current zone if Time.zone_default is set,
- # otherwise converts Date to a Time via Date#to_time
+ # Converts Date to a TimeWithZone in the current zone if Time.zone or Time.zone_default
+ # is set, otherwise converts Date to a Time via Date#to_time
def to_time_in_current_zone
- if ::Time.zone_default
+ if ::Time.zone
::Time.zone.local(year, month, day)
else
to_time