summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-08-19 09:17:20 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-08-19 09:17:20 +0000
commiteb97f7d9ee44f6d3db1c9a6b676d9692c30c1209 (patch)
tree9797bd76c56f2818272ac56b32eeed3e7e7a7390 /lib
parent1d1dd25d4255b83281b5e8e4d58a0fa1e1405cbe (diff)
downloadruby-eb97f7d9ee44f6d3db1c9a6b676d9692c30c1209.tar.gz
ruby-eb97f7d9ee44f6d3db1c9a6b676d9692c30c1209.tar.xz
ruby-eb97f7d9ee44f6d3db1c9a6b676d9692c30c1209.zip
* lib/time.rb (Time.apply_offset): fix a problem with last day of
month. reported by Lucas Nussbaum. [ruby-talk:152866] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@9006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/time.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/time.rb b/lib/time.rb
index 8694675f3..da882f911 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
@@ -774,5 +774,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