aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/time
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/core_ext/time')
-rw-r--r--activesupport/lib/active_support/core_ext/time/calculations.rb10
1 files changed, 10 insertions, 0 deletions
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 @@ module ActiveSupport #:nodoc:
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