summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--lib/date.rb7
2 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a4cfc98d4c..23763ddbb5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Mon Mar 22 19:32:34 2010 Tadayoshi Funaba <[email protected]>
+
+ * lib/date.rb (Date#>>): fixed. [ruby-core:28011]
+
Sat Mar 20 12:30:54 2010 Nobuyoshi Nakada <[email protected]>
* lib: fixed typo. a patch by Sho Hashimoto in [ruby-dev:40716].
diff --git a/lib/date.rb b/lib/date.rb
index 4323c6f2f6..5baed75969 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 <[email protected]>
#
@@ -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