Fixed Time#last_year to go back in time, not forward #1278 [fabien@odilat.com]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1319 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 26022d8d
*SVN*
* Fixed Time#last_year to go back in time, not forward #1278 [fabien@odilat.com]
* Fixed the pluralization of analysis to analyses #1295 [seattle@rootimage.msu.edu]
* Fixed that Time.local(2005,12).months_since(1) would raise "ArgumentError: argument out of range" #1311 [jhahn@niveon.com]
......
......@@ -64,12 +64,12 @@ def years_since(years)
change(:year => self.year + years)
end
# Short-hand for months_ago(1)
# Short-hand for years_ago(1)
def last_year
years_since(1)
years_ago(1)
end
# Short-hand for months_since(1)
# Short-hand for years_since(1)
def next_year
years_since(1)
end
......
......@@ -56,6 +56,10 @@ def test_years_since
# Failure because of size limitations of numeric?
# assert_equal Time.local(2182,6,5,10), Time.local(2005,6,5,10,0,0).years_since(177)
end
def test_last_year
assert_equal Time.local(2004,6,5,10), Time.local(2005,6,5,10,0,0).last_year
end
def test_ago
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册