Skip to content

Commit

Permalink
* lib/time.rb (Time.apply_offset): fix a problem with last day of
Browse files Browse the repository at this point in the history
  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
  • Loading branch information
akr committed Aug 19, 2005
1 parent 1d1dd25 commit eb97f7d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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 12:46:28 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>

* bcc32/Makefile.sub (COMMON_HEADERS): reverted 1.42.2.24.
Expand Down
8 changes: 7 additions & 1 deletion lib/time.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def apply_offset(year, mon, day, hour, min, sec, off)
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
Expand Down Expand Up @@ -774,5 +774,11 @@ def test_xmlschema_leap_second
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

0 comments on commit eb97f7d

Please sign in to comment.