diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-22 10:33:08 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-22 10:33:08 +0000 |
commit | 95c269a18c40aa9446af7a6c566835d10b0485b0 (patch) | |
tree | da0bf8ce3b1ec46606e943740f2feebbccb70080 | |
parent | 3657e15519c5610f203a97e29d4a785876539784 (diff) |
* lib/date.rb (Date#>>): fixed. [ruby-core:28011]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@27014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | lib/date.rb | 7 |
2 files changed, 9 insertions, 2 deletions
@@ -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 |