From a9a76ef0b75befec230b438029906fa9ccddb27e Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 17 Jul 2017 05:57:19 +0200 Subject: [PATCH] Improved pretty date - absolute time format (only show no year if date is in same year + only show no weekday if date is less then 6 days). --- .../javascripts/app/lib/app_post/pretty_date.coffee | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/app/lib/app_post/pretty_date.coffee b/app/assets/javascripts/app/lib/app_post/pretty_date.coffee index 9c607eee0..13c6157a2 100644 --- a/app/assets/javascripts/app/lib/app_post/pretty_date.coffee +++ b/app/assets/javascripts/app/lib/app_post/pretty_date.coffee @@ -38,11 +38,16 @@ class App.PrettyDate months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] month = months[created.getMonth()] - # for less than 7 days - if diff < (60 * 60 * 24 * 7) + # for less than 6 days + # weekday HH::MM + if diff < (60 * 60 * 24 * 6) string = "#{App.i18n.translateInline(weekday)} #{created.getHours()}:#{@s(created.getMinutes(), 2)}" - else if diff < (60 * 60 * 24 * 7) * 365 + # if it was this year + # weekday DD. MM HH::MM + else if created.getYear() is current.getYear() string = "#{App.i18n.translateInline(weekday)} #{created.getDate()}. #{App.i18n.translateInline(month)} #{created.getHours()}:#{@s(created.getMinutes(), 2)}" + # if it was the year before + # weekday YYYY-MM-DD HH::MM else string = "#{App.i18n.translateInline(weekday)} #{App.i18n.translateTimestamp(time)}" if escalation