summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/rdoc/parser/changelog.rb8
-rw-r--r--lib/time.rb3
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/rdoc/parser/changelog.rb b/lib/rdoc/parser/changelog.rb
index 782d8f09bf..75fcaaad85 100644
--- a/lib/rdoc/parser/changelog.rb
+++ b/lib/rdoc/parser/changelog.rb
@@ -145,10 +145,14 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
# HACK Ruby 1.8 does not raise ArgumentError for Time.parse "Other"
entry_name = nil unless entry_name =~ /#{time.year}/
rescue NoMethodError
+ # HACK Ruby 2.1.2 and earlier raises NoMethodError if time part is absent
time, = entry_name.split ' ', 2
- time = Time.parse time
rescue ArgumentError
- entry_name = nil
+ if /out of range/ =~ $!.message
+ time = Time.parse(entry_name.split(' ', 2)[0]) rescue entry_name = nil
+ else
+ entry_name = nil
+ end
end
entry_body = []
diff --git a/lib/time.rb b/lib/time.rb
index 3728fef59c..2225f68abb 100644
--- a/lib/time.rb
+++ b/lib/time.rb
@@ -214,7 +214,8 @@ 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
+ days = month_days(year, mon)
+ if days and days < day
mon += 1
if 12 < mon
mon = 1