diff options
author | bogdanvlviv <bogdanvlviv@gmail.com> | 2017-09-16 19:06:45 +0300 |
---|---|---|
committer | bogdanvlviv <bogdanvlviv@gmail.com> | 2017-10-24 21:17:54 +0300 |
commit | ee9d81837b5eba9d5ec869ae7601d7ffce763e3e (patch) | |
tree | dcb28197ee2c901788ae4431bb136e0994e3d209 /guides/source/active_support_core_extensions.md | |
parent | f2c1e3a793570584d9708aaee387214bc3543530 (diff) | |
download | rails-ee9d81837b5eba9d5ec869ae7601d7ffce763e3e.tar.gz rails-ee9d81837b5eba9d5ec869ae7601d7ffce763e3e.tar.bz2 rails-ee9d81837b5eba9d5ec869ae7601d7ffce763e3e.zip |
Allows pass argument for `Time#prev_year` and `Time#next_year`.
Diffstat (limited to 'guides/source/active_support_core_extensions.md')
-rw-r--r-- | guides/source/active_support_core_extensions.md | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index ae64ad93d6..a80fd5dcc1 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -2998,8 +2998,6 @@ d.prev_year # => Sun, 28 Feb 1999 d.next_year # => Wed, 28 Feb 2001 ``` -`prev_year` is aliased to `last_year`. - ##### `prev_month`, `next_month` In Ruby 1.9 `prev_month` and `next_month` return the date with the same day in the last or next month: @@ -3157,6 +3155,8 @@ Date.new(2012, 2, 29).years_ago(3) # => Sat, 28 Feb 2009 Date.new(2012, 2, 29).years_since(3) # => Sat, 28 Feb 2015 ``` +`last_year` is short-hand for `#years_ago(1)`. + ##### `months_ago`, `months_since` The methods `months_ago` and `months_since` work analogously for months: @@ -3362,7 +3362,8 @@ beginning_of_year (at_beginning_of_year) end_of_year (at_end_of_year) years_ago years_since -prev_year (last_year) +prev_year +last_year next_year on_weekday? on_weekend? @@ -3551,7 +3552,8 @@ beginning_of_year (at_beginning_of_year) end_of_year (at_end_of_year) years_ago years_since -prev_year (last_year) +prev_year +last_year next_year on_weekday? on_weekend? |