Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Fixed ruby 1.8.7 issue with dates too old
Browse files Browse the repository at this point in the history
  • Loading branch information
elgalu committed Mar 6, 2013
1 parent 10395c6 commit 3ca7b3d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/time_ago_in_words/methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ module TimeAgoInWords
#
# @note Inspired from http://stackoverflow.com/a/4136485/511069
def ago_in_words
return 'a very very long time ago' if self.year < 1800
secs = Time.now - self
return 'just now' if secs > -1 && secs < 1
return '' if secs <= -1
return 'a very very long time ago' if secs > 60*60*24*100_000
pair = ago_in_words_pair(secs)
ary = ago_in_words_singularize(pair)
ary.size == 0 ? '' : ary.join(' and ') << ' ago'
Expand Down
2 changes: 1 addition & 1 deletion spec/time_ago_in_words_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
end

it "can handle many days ago" do
(Time.now - 60*60*24*99_999).ago_in_words.should == '99999 days ago'
(Time.now - 60*60*24*9999).ago_in_words.should == '9999 days ago'
end

it "returns N seconds ago, N seconds ago!" do
Expand Down

0 comments on commit 3ca7b3d

Please sign in to comment.