Skip to content

Commit 73d72af

Browse files
committed
Fix nice timestamps for future dates
Needed for SSL expiration, since it's likely in the future.
1 parent 3367372 commit 73d72af

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

rails/app/helpers/application_helper.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,14 @@ def nice_timestamp(timestamp, brief: false)
106106
return '-' unless timestamp
107107

108108
content_tag :span, title: timestamp.to_s do
109-
brief ? brief_time_ago_in_words(timestamp) : "#{time_ago_in_words(timestamp)} ago"
109+
words = time_ago_in_words(timestamp)
110+
if brief
111+
brief_time_ago_in_words(timestamp)
112+
elsif timestamp > Time.current
113+
"in #{words}"
114+
else
115+
"#{words} ago"
116+
end
110117
end
111118
end
112119

0 commit comments

Comments
 (0)