Skip to content

Commit

Permalink
Added last_month and next_month
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@734 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Feb 21, 2005
1 parent 25f8a25 commit b08f353
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions activesupport/lib/active_support/core_ext/time/calculations.rb
Expand Up @@ -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
Expand Down

0 comments on commit b08f353

Please sign in to comment.