BigW Consortium Gitlab

Commit 91937d5b by Fatih Acet

Added a new common util called $.timefor.

It will use $.timeago behind the scene and it does the opposite of what $.timeago does. $.timefor("Thu Jun 05 2016 23:40:39 GMT+0300 (EEST)") will return "3 days remaining".
parent 94b0da42
((w) ->
jQuery.timefor = (time, suffix, expiredLabel) ->
return '' unless time
suffix or= 'remaining'
expiredLabel or= 'expired'
jQuery.timeago.settings.allowFuture = yes
{ suffixFromNow } = jQuery.timeago.settings.strings
jQuery.timeago.settings.strings.suffixFromNow = suffix
timefor = $.timeago time
if timefor.indexOf('ago') > -1
timefor = expiredLabel
jQuery.timeago.settings.strings.suffixFromNow = suffixFromNow
return timefor
) window
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