From b08f35309bbec4b309ff614b30ff45f6c7309d40 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 21 Feb 2005 14:51:10 +0000 Subject: [PATCH] Added last_month and next_month git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@734 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/active_support/core_ext/time/calculations.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb index c62a2447e8..3ebfa125be 100644 --- a/activesupport/lib/active_support/core_ext/time/calculations.rb +++ b/activesupport/lib/active_support/core_ext/time/calculations.rb @@ -53,6 +53,16 @@ def months_since(months) end end + # Short-hand for months_ago(1) + def last_month + months_ago(1) + end + + # Short-hand for months_since(1) + def next_month + months_since(1) + end + # Returns a new Time representing the "start" of this week (Monday, 0:00) def beginning_of_week (self - self.wday.days).midnight + 1.day -- GitLab