diff options
author | bogdanvlviv <bogdanvlviv@gmail.com> | 2017-09-16 18:36:49 +0300 |
---|---|---|
committer | bogdanvlviv <bogdanvlviv@gmail.com> | 2017-10-24 21:17:54 +0300 |
commit | f2c1e3a793570584d9708aaee387214bc3543530 (patch) | |
tree | 71049e85a851592601961f7f0dd0e38f6ac62215 /guides | |
parent | 61ac2167eff741bffb44aec231f4ea13d004134e (diff) | |
download | rails-f2c1e3a793570584d9708aaee387214bc3543530.tar.gz rails-f2c1e3a793570584d9708aaee387214bc3543530.tar.bz2 rails-f2c1e3a793570584d9708aaee387214bc3543530.zip |
Allows pass argument for `Time#prev_month` and `Time#next_month`
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/active_support_core_extensions.md | 12 |
1 files changed, 7 insertions, 5 deletions
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) |