summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-08 04:45:42 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-08 04:45:42 +0000
commit78492e51d818c193eb0b2a2546c6016c07a46fcd (patch)
treeb0a807515add3269df4340ac796867d8a442dab1 /lib
parentcbf33c59ded17f32783954a2226df63af9089504 (diff)
merge revision(s) 27014:
* lib/date.rb (Date#>>): fixed. [ruby-core:28011] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@28204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/date.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/date.rb b/lib/date.rb
index 19991d60b4..37c7630895 100644
--- a/lib/date.rb
+++ b/lib/date.rb
@@ -1,7 +1,7 @@
#
# date.rb - date and time library
#
-# Author: Tadayoshi Funaba 1998-2008
+# Author: Tadayoshi Funaba 1998-2010
#
# Documentation: William Webber <william@williamwebber.com>
#
@@ -1305,7 +1305,10 @@ 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