From f2c1e3a793570584d9708aaee387214bc3543530 Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Sat, 16 Sep 2017 18:36:49 +0300 Subject: Allows pass argument for `Time#prev_month` and `Time#next_month` --- guides/source/active_support_core_extensions.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'guides/source') diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 54d3dec1c2..ae64ad93d6 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -3019,11 +3019,9 @@ Date.new(2000, 5, 31).next_month # => Fri, 30 Jun 2000 Date.new(2000, 1, 31).next_month # => Tue, 29 Feb 2000 ``` -`prev_month` is aliased to `last_month`. - ##### `prev_quarter`, `next_quarter` -Same as `prev_month` and `next_month`. It returns the date with the same day in the previous or next quarter: +`prev_quarter` and `next_quarter` return the date with the same day in the previous or next quarter: ```ruby t = Time.local(2010, 5, 8) # => Sat, 08 May 2010 @@ -3175,6 +3173,8 @@ Date.new(2010, 4, 30).months_ago(2) # => Sun, 28 Feb 2010 Date.new(2009, 12, 31).months_since(2) # => Sun, 28 Feb 2010 ``` +`last_month` is short-hand for `#months_ago(1)`. + ##### `weeks_ago` The method `weeks_ago` works analogously for weeks: @@ -3353,8 +3353,9 @@ months_ago months_since beginning_of_month (at_beginning_of_month) end_of_month (at_end_of_month) -prev_month (last_month) +prev_month next_month +last_month beginning_of_quarter (at_beginning_of_quarter) end_of_quarter (at_end_of_quarter) beginning_of_year (at_beginning_of_year) @@ -3541,8 +3542,9 @@ months_ago months_since beginning_of_month (at_beginning_of_month) end_of_month (at_end_of_month) -prev_month (last_month) +prev_month next_month +last_month beginning_of_quarter (at_beginning_of_quarter) end_of_quarter (at_end_of_quarter) beginning_of_year (at_beginning_of_year) -- cgit v1.2.3