summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-06-21 12:23:58 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-06-21 12:23:58 +0000
commit8db049f856a4d584db0e1b45b988ad6750d803c5 (patch)
treec4611258726f9182e0cec6ae7c34f6a2cad75eb3
parent1632d2d2eafb65513759823916563b2bd37477bd (diff)
downloadruby-8db049f856a4d584db0e1b45b988ad6750d803c5.tar.gz
ruby-8db049f856a4d584db0e1b45b988ad6750d803c5.tar.xz
ruby-8db049f856a4d584db0e1b45b988ad6750d803c5.zip
fixed an issue about mathn.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@10360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/date.rb4
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 7faa4e229..720bbcd10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Jun 21 21:20:31 2006 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date.rb (jd_to_commercial): now works fine even if in
+ mathn-ized context.
+
Wed Jun 21 17:29:57 2006 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/socket/getaddrinfo.c (freeaddrinfo, get_name): fixed typo.
diff --git a/lib/date.rb b/lib/date.rb
index 93419091a..722ecd154 100644
--- a/lib/date.rb
+++ b/lib/date.rb
@@ -1,7 +1,7 @@
#
# date.rb - date and time library
#
-# Author: Tadayoshi Funaba 1998-2005
+# Author: Tadayoshi Funaba 1998-2006
#
# Documentation: William Webber <william@williamwebber.com>
#
@@ -370,7 +370,7 @@ class Date
ns = ns?(jd, sg)
a = jd_to_civil(jd - 3, ns)[0]
y = if jd >= commercial_to_jd(a + 1, 1, 1, ns) then a + 1 else a end
- w = 1 + (jd - commercial_to_jd(y, 1, 1, ns)) / 7
+ w = 1 + ((jd - commercial_to_jd(y, 1, 1, ns)) / 7).floor
d = (jd + 1) % 7
if d.zero? then d = 7 end
return y, w, d