summaryrefslogtreecommitdiff
path: root/lib/date.rb
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-22 10:32:10 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-22 10:32:10 +0000
commit5d8f69503299ef719c5523546cf2745de136cea9 (patch)
treeba09f2b3801e16c6764de59236b8a43888679cf9 /lib/date.rb
parent652484598d802cd808b4b1fe4bef263b53e3119c (diff)
* lib/date.rb (Date#>>): fixed. [ruby-core:28011]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/date.rb')
-rw-r--r--lib/date.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/date.rb b/lib/date.rb
index daa51d8e0e..3bb0875023 100644
--- a/lib/date.rb
+++ b/lib/date.rb
@@ -1,7 +1,7 @@
#
# date.rb - date and time library
#
-# Author: Tadayoshi Funaba 1998-2009
+# Author: Tadayoshi Funaba 1998-2010
#
# Documentation: William Webber <william@williamwebber.com>
#
@@ -1416,7 +1416,10 @@ class Date
y, m = (year * 12 + (mon - 1) + n).divmod(12)
m, = (m + 1) .divmod(1)
d = mday
- d -= 1 until jd2 = _valid_civil?(y, m, d, @sg)
+ until jd2 = _valid_civil?(y, m, d, @sg)
+ d -= 1
+ raise ArgumentError, 'invalid date' unless d > 0
+ end
self + (jd2 - jd)
end