Module: FormatTime
- Includes:
- ActionView::Helpers::DateHelper
- Defined in:
- lib/format_time.rb,
lib/format_time/version.rb
Defined Under Namespace
Classes: Error
Constant Summary collapse
- VERSION =
"0.1.1"
Instance Method Summary collapse
- #format_absolute_time(time) ⇒ Object
-
#format_relative_time(time) ⇒ Object
Your code goes here…
Instance Method Details
#format_absolute_time(time) ⇒ Object
13 14 15 |
# File 'lib/format_time.rb', line 13 def format_absolute_time(time) Time.current.year == time.year ? in_year(time) : prevous_year(time) end |
#format_relative_time(time) ⇒ Object
Your code goes here…
9 10 11 |
# File 'lib/format_time.rb', line 9 def format_relative_time(time) distance_of_time_in_words_to_now(time, include_seconds: true) end |