Commit 6ddf99c2 authored by Gergely Ujvari's avatar Gergely Ujvari

Kill fuzzyTime filter

parent 089fcea3
......@@ -7,54 +7,6 @@ class Converter extends Markdown.Converter
text.replace /<a href=/g, "<a target=\"_blank\" href="
fuzzyTime = (date, next = false) ->
return '' if not date
delta = Math.round((+new Date - new Date(date)) / 1000)
minute = 60
hour = minute * 60
day = hour * 24
week = day * 7
month = day * 30
year = day * 365
if (delta < 30)
fuzzy = 'moments ago'
nextUpdate = 30 - delta
else if (delta < minute)
fuzzy = delta + ' seconds ago'
nextUpdate = 1
else if (delta < 2 * minute)
fuzzy = 'a minute ago'
nextUpdate = 2*minute - delta
else if (delta < hour)
fuzzy = Math.floor(delta / minute) + ' minutes ago'
nextUpdate = minute
else if (Math.floor(delta / hour) == 1)
fuzzy = '1 hour ago'
nextUpdate = hour
else if (delta < day)
fuzzy = Math.floor(delta / hour) + ' hours ago'
nextUpdate = hour
else if (delta < day * 2)
fuzzy = 'yesterday'
nextUpdate = 2*day - delta
else if (delta < month)
fuzzy = Math.round(delta / day) + ' days ago'
nextUpdate = day
else if (delta < year)
fuzzy = Math.round(delta / month) + ' months ago'
nextUpdate = month
else
fuzzy = Math.round(delta / year) + ' years ago'
nextUpdate = year
if next
nextUpdate
else
fuzzy
momentFilter = ->
(value, format) ->
# Determine the timezone name and browser language.
......@@ -80,6 +32,5 @@ persona = (user, part='username') ->
angular.module('h')
.filter('converter', -> (new Converter()).makeHtml)
.filter('fuzzyTime', -> fuzzyTime)
.filter('moment', momentFilter)
.filter('persona', -> persona)
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