summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorwyhaines <wyhaines@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-08 16:54:21 +0000
committerwyhaines <wyhaines@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-08 16:54:21 +0000
commit44c8d6c4dbc75555ab2993ca1b39c42771313437 (patch)
tree919a6066fc218ab3d01a1adb7786cd3040a522e8 /lib
parent13e40bdaa08d004edb45c2be872a812236296f31 (diff)
lib/date.rb: Backport #2707 [ruby-core:28011]; backport r27014 to fix problem with Date#>> and very small numbers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@28233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/date.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/date.rb b/lib/date.rb
index ea557313f7..d562fd12b1 100644
--- a/lib/date.rb
+++ b/lib/date.rb
@@ -1273,7 +1273,11 @@ class Date
y, m = (year * 12 + (mon - 1) + n).divmod(12)
m, = (m + 1) .divmod(1)
d = mday
- d -= 1 until jd2 = self.class.valid_civil?(y, m, d, fix_style)
+ until jd2 = self.class.valid_civil?(y, m, d, fix_style)
+ d -= 1
+ raise ArgumentError, 'invalid date' unless d > 0
+ end
+
self + (jd2 - jd)
end