Rails: DateTime helper for today, tomorrow

is there a DateTime helper in Rails (or a gem), that checks if a given DateTime is today, tomorrow… and produces outputs like today, at 3pm, tomorrow, at 3pm or next Tuesday, at 3pm?

I’ve found the time_ago_in_words helper http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#method-i-time_ago_in_words but that’s a different use case.

I can’t find anything that formats a DateTime object like the examples from above. I found a solution for JavaScript (http://momentjs.com/docs/#/displaying/calendar-time/), and I’m searching for a similar one in Ruby.

Source: ruby

Leave a Reply