diff options
author | Xavier Noria <fxn@hashref.com> | 2012-02-28 01:37:19 -0800 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2012-02-28 01:37:19 -0800 |
commit | 699ba8ab52973bf0499643235f162734fb644ab7 (patch) | |
tree | 51f6081921c27eaf906460a208efa46f03467909 /railties/guides | |
parent | 43faccf45fed33a5e529d0a156f958b9d8b785b7 (diff) | |
parent | d6366625e04c516bf5f4bd6f561c3bb1945b0c82 (diff) | |
download | rails-699ba8ab52973bf0499643235f162734fb644ab7.tar.gz rails-699ba8ab52973bf0499643235f162734fb644ab7.tar.bz2 rails-699ba8ab52973bf0499643235f162734fb644ab7.zip |
Merge pull request #4284 from mattdbridges/time_calculation_aliases
Added aliases for prev_year, prev_month, and prev_week in Time and Date calculations
Diffstat (limited to 'railties/guides')
-rw-r--r-- | railties/guides/source/active_support_core_extensions.textile | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 61fdb5ccc6..2091ce0395 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -2869,6 +2869,8 @@ d.next_year # => Wed, 28 Feb 2001 Active Support defines these methods as well for Ruby 1.8. ++prev_year+ is aliased to +last_year+. + h6. +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: @@ -2890,6 +2892,8 @@ Date.new(2000, 1, 31).next_month # => Tue, 29 Feb 2000 Active Support defines these methods as well for Ruby 1.8. ++prev_month+ is aliased to +last_month+. + h6. +beginning_of_week+, +end_of_week+ The methods +beginning_of_week+ and +end_of_week+ return the dates for the @@ -2935,6 +2939,8 @@ d.prev_week(:saturday) # => Sat, 01 May 2010 d.prev_week(:friday) # => Fri, 30 Apr 2010 </ruby> ++prev_week+ is aliased to +last_week+. + h6. +beginning_of_month+, +end_of_month+ The methods +beginning_of_month+ and +end_of_month+ return the dates for the beginning and end of the month: @@ -3145,13 +3151,13 @@ end_of_week (at_end_of_week) monday sunday weeks_ago -prev_week +prev_week (last_week) next_week months_ago months_since beginning_of_month (at_beginning_of_month) end_of_month (at_end_of_month) -prev_month +prev_month (last_month) next_month beginning_of_quarter (at_beginning_of_quarter) end_of_quarter (at_end_of_quarter) @@ -3159,7 +3165,7 @@ beginning_of_year (at_beginning_of_year) end_of_year (at_end_of_year) years_ago years_since -prev_year +prev_year (last_year) next_year </ruby> @@ -3321,13 +3327,13 @@ end_of_week (at_end_of_week) monday sunday weeks_ago -prev_week +prev_week (last_week) next_week months_ago months_since beginning_of_month (at_beginning_of_month) end_of_month (at_end_of_month) -prev_month +prev_month (last_month) next_month beginning_of_quarter (at_beginning_of_quarter) end_of_quarter (at_end_of_quarter) @@ -3335,7 +3341,7 @@ beginning_of_year (at_beginning_of_year) end_of_year (at_end_of_year) years_ago years_since -prev_year +prev_year (last_year) next_year </ruby> |