Commit 9316e1a0 authored by Ujvari Gergely's avatar Ujvari Gergely

Extend fuzzyTime filter for dates older than one month.

Previously the fuzzyTime filter showed fuzzy value for dates no older than 30 days. After that it just displayed an unformatted new Date(date) which looks strange compared to the other displayed time strings.
Now it has been extended to show x. month ago and y years ago.

Fixes #799
parent a6ab11f2
......@@ -16,6 +16,7 @@ fuzzyTime = (date) ->
day = hour * 24
week = day * 7
month = day * 30
year = day * 365
if (delta < 30)
fuzzy = 'moments ago'
......@@ -33,9 +34,11 @@ fuzzyTime = (date) ->
fuzzy = 'yesterday'
else if (delta < month)
fuzzy = Math.round(delta / day) + ' days ago'
else if (delta < year)
fuzzy = Math.round(delta / month) + ' months ago'
else
fuzzy = new Date(date)
fuzzy = Math.round(delta / year) + ' years ago'
fuzzy
userName = (user) ->
(user?.match /^acct:([^@]+)/)?[1]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment