Skip to content

Should enable future date by default #33

Open
@DannyBen

Description

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 %>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions