messagerie: better format message dates

This commit is contained in:
Pierre de La Morinerie 2018-09-06 13:04:43 +00:00 committed by gregoirenovel
parent fe13871380
commit 211674435e
5 changed files with 57 additions and 1 deletions

View file

@ -4,4 +4,10 @@ module CommentaireHelper
"from-me"
end
end
def commentaire_date(commentaire)
is_current_year = (commentaire.created_at.year == Date.current.year)
template = is_current_year ? :message_date : :message_date_with_year
I18n.l(commentaire.created_at.localtime, format: template)
end
end