title: jQuery Time Ago with Twitter Plugin
body: <p>I found this function on a forum somewhere and I am using it with Tweetable to show my last tweet on my website. Unfortunately, it's not grabbing time correctly. For the first hour, it says "less than a minute ago", then a couple hours go by then it changes to "less than an hour ago", then two days go by and it changes to "less than a day ago". I'm sure its something stupid in the calculation.</p>
  
  <pre><code>function relTime(time_value) {
           time_value = time_value.replace(/(\+[0-9]{4}\s)/ig,"");
           var parsed_date = Date.parse(time_value);
           var relative_to = (arguments.length &gt; 1) ? arguments[1] : new Date();
           var timeago = parseInt((relative_to.getTime() - parsed_date) / 1000);
           if (timeago &lt; 60) return 'less than a minute ago';
           else if(timeago &lt; 120) return 'about a minute ago';
           else if(timeago &lt; (45*60)) return (parseInt(timeago / 60)).toString() + ' minutes ago';
           else if(timeago &lt; (90*60)) return 'about an hour ago';
           else if(timeago &lt; (24*60*60)) return 'about ' + (parseInt(timeago / 3600)).toString() + ' hours ago';
           else if(timeago &lt; (48*60*60)) return '1 day ago';
                else return (parseInt(timeago / 86400)).toString() + ' days ago';
           }
  </code></pre>
  
  <p>Then its being put into the post like so:</p>
  
  <pre><code>if (defaults.time == true)
     $('li#tweet-'+i).append('&lt;p class="created-date"&gt;'+relTime(item.created_at)+'&lt;/p&gt;');
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>