aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/date_and_time/calculations.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2016-05-16 14:18:43 -0400
committerSean Griffin <sean@seantheprogrammer.com>2016-05-16 14:18:43 -0400
commit3d4e712cd0adc47b74bae9a844ce6cf719861618 (patch)
tree48aa8d8b1425eb97291c498bec738446bc48eb63 /activesupport/lib/active_support/core_ext/date_and_time/calculations.rb
parenta7ecc636794a8cf1d90fc60b4fa5f7c70a19d573 (diff)
parentf005202972cdb864327c854404fd18510e00f963 (diff)
downloadrails-3d4e712cd0adc47b74bae9a844ce6cf719861618.tar.gz
rails-3d4e712cd0adc47b74bae9a844ce6cf719861618.tar.bz2
rails-3d4e712cd0adc47b74bae9a844ce6cf719861618.zip
Merge pull request #24930 from henrik/date-all-day
Introduce Date#all_day
Diffstat (limited to 'activesupport/lib/active_support/core_ext/date_and_time/calculations.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/date_and_time/calculations.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/date_and_time/calculations.rb b/activesupport/lib/active_support/core_ext/date_and_time/calculations.rb
index 4da7fdd159..6206546672 100644
--- a/activesupport/lib/active_support/core_ext/date_and_time/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/date_and_time/calculations.rb
@@ -294,6 +294,11 @@ module DateAndTime
end
alias :at_end_of_year :end_of_year
+ # Returns a Range representing the whole day of the current date/time.
+ def all_day
+ beginning_of_day..end_of_day
+ end
+
# Returns a Range representing the whole week of the current date/time.
# Week starts on start_day, default is <tt>Date.week_start</tt> or <tt>config.week_start</tt> when set.
def all_week(start_day = Date.beginning_of_week)