aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/date/calculations.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/date/calculations.rb b/activesupport/lib/active_support/core_ext/date/calculations.rb
index 183471706b..1e2dbf118e 100644
--- a/activesupport/lib/active_support/core_ext/date/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/date/calculations.rb
@@ -25,6 +25,11 @@ module ActiveSupport #:nodoc:
def tomorrow
::Date.today.tomorrow
end
+
+ # Returns Time.zone.today when config.time_zone is set, otherwise just returns Date.today.
+ def current
+ ::Time.zone_default ? ::Time.zone.today : ::Date.today
+ end
end
# Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00)