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).
This commit is contained in:
parent
866614122d
commit
a9a76ef0b7
1 changed files with 8 additions and 3 deletions
|
@ -38,11 +38,16 @@ class App.PrettyDate
|
||||||
months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
||||||
month = months[created.getMonth()]
|
month = months[created.getMonth()]
|
||||||
|
|
||||||
# for less than 7 days
|
# for less than 6 days
|
||||||
if diff < (60 * 60 * 24 * 7)
|
# weekday HH::MM
|
||||||
|
if diff < (60 * 60 * 24 * 6)
|
||||||
string = "#{App.i18n.translateInline(weekday)} #{created.getHours()}:#{@s(created.getMinutes(), 2)}"
|
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)}"
|
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
|
else
|
||||||
string = "#{App.i18n.translateInline(weekday)} #{App.i18n.translateTimestamp(time)}"
|
string = "#{App.i18n.translateInline(weekday)} #{App.i18n.translateTimestamp(time)}"
|
||||||
if escalation
|
if escalation
|
||||||
|
|
Loading…
Reference in a new issue