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

Should enable future date by default #33

Open
DannyBen opened this issue Oct 5, 2015 · 1 comment
Open

Should enable future date by default #33

DannyBen opened this issue Oct 5, 2015 · 1 comment
Milestone

Comments

@DannyBen
Copy link

DannyBen commented Oct 5, 2015

This gem is doing a great job at simplifying live timestamp in rails.

I believe it should enable support for future dates by default, or at least provide an easy way (initializer option) to do so.

Even after following the discussion in issue #7 , I was unable to make it work without the need to add extra options to future dates.

I have added this to my application head:

<script>jQuery.timeago.settings.allowFuture = true;</script>

I have tested that future date works with this:

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

But, what I really want is for this to work:

<%= timeago_tag Time.now %>
<%= timeago_tag 1.hours.from_now %>

Adding the limit option to an initializer, breaks one of the above (depends on whether the limit is in the past or future), and using the force option has the undesired side effect of ignoring the limit.

If there is a way around it, I think it should be mentioned somewhere clearly in the README, even if the suggestion to make it work out of the box is rejected.

EDIT

Also, I am not sure if its a bug or a feature - but most likely related.
I was expecting the below two blocks to work the same. Pasted here as a repro case:

<h2>Doesnt work (first line is not converted)</h2>
<br><%= timeago_tag Time.now,         limit: 3.days.from_now %>
<br><%= timeago_tag 1.hours.from_now, limit: 3.days.from_now %>

<h2>Works</h2>
<br><%= timeago_tag Time.now,         force: true %>
<br><%= timeago_tag 1.hours.from_now, force: true %>
@jgraichen jgraichen added this to the Next major milestone Jun 18, 2016
@watbe
Copy link

watbe commented Jun 19, 2016

Thanks for bringing this issue to light - we had wrapped everything with a limit and subsequently I couldn't figure out why allowFuture wasn't working as a setting. This definitely seems like a bug.

I think it would also be intuitive to enabled allowFuture by default, or otherwise ensure limit does not override this functionality.

Thanks for the great plugin!

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