radar/distance_of_time_in_words

`vague: true` can't be passed to `distance_of_time_in_words_to_now`?

Closed this issue · 8 comments

Is it just me or can vague: true not be passed to distance_of_time_in_words_to_now like it can with distance_of_time_in_words?

Am I missing something or is this a bug or a design decision?

Thanks.

Where did you find distance_of_time_in_words_to_now?

https://apidock.com/rails/v5.2.3/ActionView/Helpers/DateHelper/distance_of_time_in_words_to_now

Definitely a Rails thing, but looking deeper, it's an alias of time_ago_in_words, which in turn just calls distance_of_time_in_words.

def time_ago_in_words(from_time, options = {})
  distance_of_time_in_words(from_time, Time.now, options)
end

It certainly uses dotiw when calling it, but there must be a mismatch of params that prevents options like vague: true from being passed to it and properly down the chain.

It's certainly not by design, and if we can help it, let's fix it. I would write a spec first here to begin with.

Good stuff. I'll write the spec and take it from there. Thanks for the quick response and the support behind this change.

Hey @dblock, I created a failing spec for distance_of_time_in_words_to_now when options are passed.

You can see the draft PR here:

#117

Take a look and let me know what the best plan forward is. Happy to do it.

Thanks!

Thanks for the spec! Did you try fixing it?

Working on it now... :)

Okay, fix is in. All tests passing with appraisal in development. Will wait for CI to run its tests. And then over to you.

Let me know if you need anything else on my end.