diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-08-19 09:17:20 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-08-19 09:17:20 +0000 |
commit | c2eda1c4e99be68e7c26ae2bc6c10e67c51d469a (patch) | |
tree | db966caa27c6f5f647e849e5a2ff765cafc05c4e | |
parent | a2f590d1574f7e96dce674dfa688e5dd336bce33 (diff) | |
download | ruby-c2eda1c4e99be68e7c26ae2bc6c10e67c51d469a.tar.gz |
* lib/time.rb (Time.apply_offset): fix a problem with last day of
month. reported by Lucas Nussbaum. [ruby-talk:152866]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/time.rb | 8 |
2 files changed, 12 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Fri Aug 19 18:13:39 2005 Tanaka Akira <akr@m17n.org> + + * lib/time.rb (Time.apply_offset): fix a problem with last day of + month. reported by Lucas Nussbaum. [ruby-talk:152866] + Thu Aug 18 11:05:36 2005 NAKAMURA Usaku <usa@ruby-lang.org> * win32/win32.c (socketpair_internal): need to call open_ifs_socket() diff --git a/lib/time.rb b/lib/time.rb index e1e1a1340a..f792e0cace 100644 --- a/lib/time.rb +++ b/lib/time.rb @@ -116,7 +116,7 @@ class Time if o != 0 then hour += o; o, hour = hour.divmod(24); off += o end if off != 0 day += off - if month_days(year, mon) <= day + if month_days(year, mon) < day mon += 1 if 12 < mon mon = 1 @@ -791,5 +791,11 @@ if __FILE__ == $0 assert_equal(t, Time.xmlschema("1999-01-01T00:00:00+00:00")) assert_equal(t, Time.xmlschema("1998-12-31T23:00:00-01:00")) end + + def test_ruby_talk_152866 + t = Time::xmlschema('2005-08-30T22:48:00-07:00') + assert_equal(31, t.day) + assert_equal(8, t.mon) + end end end |