Module: Watchmob::ViewHelpers

Included in:
Watchlist
Defined in:
lib/watchmob/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#format_datetime(time) ⇒ Object



3
4
5
# File 'lib/watchmob/view_helpers.rb', line 3

def format_datetime(time)
  time.strftime("%Y-%m-%d %H:%M:%S")
end

#format_time_interval(seconds) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/watchmob/view_helpers.rb', line 7

def format_time_interval(seconds)
  if seconds > 2*24*60*60
    "#{(seconds / (24*60*60)).round} days" 
  else
    "#{(seconds / (60*60)).round} hours"
  end
end