mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-25 08:39:38 -05:00
18 lines
280 B
Ruby
18 lines
280 B
Ruby
module EmbedHelper
|
|
|
|
def embed_post_date(dt)
|
|
current = Time.now
|
|
|
|
if dt >= 1.day.ago
|
|
distance_of_time_in_words(dt, current)
|
|
else
|
|
if dt.year == current.year
|
|
dt.strftime("%e %b")
|
|
else
|
|
dt.strftime("%b '%y")
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|
|
|