Skip to content

Commit

Permalink
Add second(s) resolution to time ago in words (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
bedrock-adam authored Nov 11, 2024
1 parent d12d58b commit 2e220f0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/outboxer/web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ def human_readable_size(kilobytes)

"#{size.round(2)} #{unit}"
end

def time_ago_in_words(time)
seconds_diff = (Time.now - time).to_i

if seconds_diff < 60
"#{seconds_diff} #{seconds_diff == 1 ? 'second' : 'seconds'}"
else
super
end
end
end

error StandardError do
Expand Down

0 comments on commit 2e220f0

Please sign in to comment.