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
Great library! Structured so much nicer than jquery-timeago for single-page js apps in terms of memory usage, etc.
Feature request: support the formatting of future dates like "in 2 months".
allowFuture
fromNow
$.fn.timeago.Constructor.prototype.timeAgoInWords = function(timeString) { return moment(timeString).fromNow(); };
The text was updated successfully, but these errors were encountered:
My simple update to support future times as to update the TimeAgo.prototype.timeAgoInWords() function to the following:
TimeAgo.prototype.timeAgoInWords = function(timeString) { var absolutTime; absolutTime = this.parse(timeString); if ( ( new Date().getTime() - absolutTime.getTime() ) > 0 ) { return "" + this.options.lang.prefixes.ago + (this.distanceOfTimeInWords(absolutTime)) + this.options.lang.suffix; } else { return this.options.lang.futurePrefix + this.options.lang.prefixes.ago + (this.distanceOfTimeInWords(absolutTime)); } };
then in $.fn.timeago.defaults's "lang" key insert a line below "suffix": futurePrefix: 'in ',
futurePrefix: 'in ',
Sorry, something went wrong.
No branches or pull requests
Great library! Structured so much nicer than jquery-timeago for single-page js apps in terms of memory usage, etc.
Feature request: support the formatting of future dates like "in 2 months".
allowFuture
option from jquery-timeago (although I think it should be on by default)fromNow
for the duration formatting. I'm currently doing it this way:The text was updated successfully, but these errors were encountered: