Module: Crm::LiveEventsHelper

Defined in:
app/helpers/crm/live_events_helper.rb

Overview

View helper: live events.

Instance Method Summary collapse

Instance Method Details

#air_date_in_words(air_date) ⇒ String

Formats an air date as a human-readable relative time phrase.

Parameters:

  • air_date (Time, DateTime)

    the date/time to describe

Returns:

  • (String)

    a phrase like "in 2 hours" or "3 days ago"



8
9
10
# File 'app/helpers/crm/live_events_helper.rb', line 8

def air_date_in_words(air_date)
  "#{'in' if Time.current <= air_date} #{distance_of_time_in_words_to_now(air_date)} #{'ago' if Time.current > air_date}"
end