+ def human_readable_time_html t
+ begin
+ t = Time.parse(t) unless t.is_a? Time
+ rescue
+ return ''
+ end
+ now = Time.now
+ delta = (now - t).abs
+ if delta < 12.hours
+ t.strftime('%I:%M%P').downcase.sub(/^0/,'')
+ elsif (delta < 2.months and now>t) or t.strftime('%Y')==now.strftime('%Y')
+ # recent, or this year (hopefully unambiguous in context)
+ t.strftime('%b %d').sub(/ 0/,' ')
+ else
+ t.strftime('%b %d, %Y').sub(/ 0/,' ')
+ end
+ end
+