We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There are many cases where you want relative time, but not the word "ago".
For instance: In stage for 18 hours
Would be nice to be able to toggle off "ago" in the realtive output.
The text was updated successfully, but these errors were encountered:
Just using my own function for this now
timeSince: (date) => { if (!date) return date = new Date(date) let seconds = Math.floor((new Date() - date) / 1000) let interval = seconds / 31536000 if (interval > 1) { let value = Math.floor(interval) if (value == 1) return '1 year' else return value + ' years' } interval = seconds / 2592000 if (interval > 1) { let value = Math.floor(interval) if (value == 1) return '1 month' else return value + ' months' } interval = seconds / 86400 if (interval > 1) { let value = Math.floor(interval) if (value == 1) return '1 day' else return value + ' days' } interval = seconds / 3600 if (interval > 1) { let value = Math.floor(interval) if (value == 1) return '1 hour' else return value + ' hours' } interval = seconds / 60 if (interval > 1) { let value = Math.floor(interval) if (value == 1) return '1 minute' else return value + ' minutes' } let value = Math.floor(seconds) if (value == 1) return '1 second' else return value + ' seconds' },
Sorry, something went wrong.
No branches or pull requests
There are many cases where you want relative time, but not the word "ago".
For instance: In stage for 18 hours
Would be nice to be able to toggle off "ago" in the realtive output.
The text was updated successfully, but these errors were encountered: