aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorbogdanvlviv <bogdanvlviv@gmail.com>2017-09-16 17:33:53 +0300
committerbogdanvlviv <bogdanvlviv@gmail.com>2017-10-24 21:17:54 +0300
commit61ac2167eff741bffb44aec231f4ea13d004134e (patch)
tree225b23cc0e114451682d851de9a35d5d204c5f4b /activesupport/lib
parent453ab1758bd57b971f3ecc9f173198e8fac38e1c (diff)
downloadrails-61ac2167eff741bffb44aec231f4ea13d004134e.tar.gz
rails-61ac2167eff741bffb44aec231f4ea13d004134e.tar.bz2
rails-61ac2167eff741bffb44aec231f4ea13d004134e.zip
Allows pass argument for `Time#prev_day` and `Time#next_day`
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/date_and_time/calculations.rb12
1 files changed, 6 insertions, 6 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 265c6949e1..9b5477b199 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
@@ -20,9 +20,9 @@ module DateAndTime
advance(days: -1)
end
- # Returns a new date/time representing the previous day.
- def prev_day
- advance(days: -1)
+ # Returns a new date/time the specified number of days ago.
+ def prev_day(days = 1)
+ advance(days: -days)
end
# Returns a new date/time representing tomorrow.
@@ -30,9 +30,9 @@ module DateAndTime
advance(days: 1)
end
- # Returns a new date/time representing the next day.
- def next_day
- advance(days: 1)
+ # Returns a new date/time the specified number of days in the future.
+ def next_day(days = 1)
+ advance(days: days)
end
# Returns true if the date/time is today.