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

Unexpected output: "less than 1 second" with only: [:years, :months] #50

Closed
devdicated opened this issue Mar 10, 2015 · 4 comments
Closed

Comments

@devdicated
Copy link
Contributor

I'm trying to output an age in years and months, but when the output is less than 1 month it outputs "less than 1 second":
https://github.com/radar/dotiw/blob/master/lib/dotiw/action_view_ext/helpers/date_helper.rb#L61

I think the output should rather be "less than 1 month" or "0 months".

@radar
Copy link
Owner

radar commented Mar 10, 2015

Please provide exact steps to reproduce this problem.

On 11 Mar 2015, at 01:17, rvenk notifications@github.com wrote:

I'm trying to output an age in years and months, but when the output is less than 1 month it outputs "less than 1 second": (https://github.com/radar/dotiw/blob/master/lib/dotiw/action_view_ext/helpers/date_helper.rb#L61)

I think the output should rather be "less than 1 month" or "0 months".


Reply to this email directly or view it on GitHub.

@devdicated
Copy link
Contributor Author

Quite simple:
distance_of_time_in_words(Time.now, Time.now, only: [:years, :months])

Edit
Just to be clear, the output is also "less than 1 second" if the distance is several days:
distance_of_time_in_words(15.days.ago, Time.now, only: [:years, :months])

@radar
Copy link
Owner

radar commented Mar 14, 2015

I think this would be a large reworking of how the logic in dotiw works. I do not have the time/energy to do this right now. Can you please investigate a fix for this?

@devdicated
Copy link
Contributor Author

No problem, I'll start working on this later this week.

radar added a commit that referenced this issue Mar 22, 2015
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

2 participants