Is there a ruby gem that will format dates relative to the current time? I want output like “Tomorrow at 5pm”, “Thursday next week at 5:15pm”, I’m not too concerned about the exact output, just as long as it’s relative dates in natural language
Share
if you have rails, I think ActionView::Helpers::DateHelper#distance_of_time_in_words helps that.
In case of relative to the current time, use
distance_of_time_in_words_to_nowinstead ofdistance_of_time_in_words.If your app is rails-based, just use
distance_of_time_in_words,distance_of_time_in_words_to_now,time_ago_in_wordsin view.