Skip to content

Instantly share code, notes, and snippets.

Greg Blass gregblass

Block or report user

Report or block gregblass

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gregblass
gregblass / better_time_ago_in_words.rb
Last active Oct 4, 2017
A better, Facebook-style activity time_ago_in_words
View better_time_ago_in_words.rb
def better_time_ago_in_words(date_time)
if date_time < 2.days.ago
"#{date_time.strftime('%B %e')} at #{date_time.strftime('%l:%M%P')}"
elsif date_time < 1.day.ago
"Yesterday at #{date_time.strftime('%l:%M%P')}"
else
time_ago_in_words(date_time)
end
end
You can’t perform that action at this time.