Skip to content
New issue

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

no way to set option allowFuture #7

Closed
mprokopov opened this issue Aug 27, 2012 · 2 comments
Closed

no way to set option allowFuture #7

mprokopov opened this issue Aug 27, 2012 · 2 comments

Comments

@mprokopov
Copy link
Contributor

from documentation:

To support timestamps in the future, use the allowFuture setting:
jQuery.timeago.settings.allowFuture = true;

but here is no such option support in gem

@jgraichen
Copy link
Owner

You can just set it in your application.js:

//= require rails-timeago
jQuery.timeago.settings.allowFuture = true;

@olliebennett
Copy link

Perhaps helpful for others, I had a problem when implementing the proposed configuration.

Even when configuring the allowFuture option, any future dates/times were not being processed. This was due to the fact that they weren't created with the data-time-ago attribute by the timeago_tag helper (and so weren't matched by the time[data-time-ago] jQuery selector).

In order to resolve the problem, you need to either specify a limit in the future:

<%= timeago_tag 1.day.from_now, limit: 1.year.from_now %>

Or enable the force option:

<%= timeago_tag 1.day.from_now, force: true %>

Either of these options could alternatively be specified in an initialiser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants