From 3ca7b3d42b1daf4c7228dbc47b6dc8e97ae37537 Mon Sep 17 00:00:00 2001 From: Leo Gallucci Date: Wed, 6 Mar 2013 10:55:36 -0300 Subject: [PATCH] Fixed ruby 1.8.7 issue with dates too old --- lib/time_ago_in_words/methods.rb | 2 +- spec/time_ago_in_words_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/time_ago_in_words/methods.rb b/lib/time_ago_in_words/methods.rb index 3c736df..7a58255 100644 --- a/lib/time_ago_in_words/methods.rb +++ b/lib/time_ago_in_words/methods.rb @@ -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' diff --git a/spec/time_ago_in_words_spec.rb b/spec/time_ago_in_words_spec.rb index 84db529..ee2574f 100644 --- a/spec/time_ago_in_words_spec.rb +++ b/spec/time_ago_in_words_spec.rb @@ -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