Skip to content

Instantly share code, notes, and snippets.

@eqbal
Created December 6, 2016 13:08
Show Gist options
  • Save eqbal/f89be6dc073851f6f3afe507bbcf54bf to your computer and use it in GitHub Desktop.
Save eqbal/f89be6dc073851f6f3afe507bbcf54bf to your computer and use it in GitHub Desktop.
module EntriesHelper
def readable_time_period(entry)
mins = entry.time_period
return Time.at(60 * mins).utc.strftime('%M <small>Mins</small>').html_safe if mins < 60
Time.at(60 * mins).utc.strftime('%H <small>Hour</small> %M <small>Mins</small>').html_safe
end
def readable_speed(entry)
"#{sprintf('%0.2f', entry.speed)} <small>Km/H</small>".html_safe
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment