Last active
September 15, 2016 18:38
-
-
Save vhpoet/fe1539e6b0d8bf00e76582c3b0d6a017 to your computer and use it in GitHub Desktop.
TimeAgo "a few seconds ago" formatter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timeAgoFormatter = (value, unit, suffix) => { | |
if (unit !== 'second') { | |
return [value, unit + (value !== 1 ? 's' : ''), suffix].join(' ') | |
} | |
if (suffix === 'ago') { | |
return 'a few seconds ago' | |
} | |
if (suffix === 'from now') { | |
return 'in a few seconds' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment