Commit 33a4a84e authored by Robert Speicher's avatar Robert Speicher

Make time_ago_with_tooltip support a Date value

parent ce5bc4f8
...@@ -199,7 +199,7 @@ module ApplicationHelper ...@@ -199,7 +199,7 @@ module ApplicationHelper
def time_ago_with_tooltip(time, placement: 'top', html_class: 'time_ago', skip_js: false) def time_ago_with_tooltip(time, placement: 'top', html_class: 'time_ago', skip_js: false)
element = content_tag :time, time.to_s, element = content_tag :time, time.to_s,
class: "#{html_class} js-timeago", class: "#{html_class} js-timeago",
datetime: time.getutc.iso8601, datetime: time.to_time.getutc.iso8601,
title: time.in_time_zone.stamp('Aug 21, 2011 9:23pm'), title: time.in_time_zone.stamp('Aug 21, 2011 9:23pm'),
data: { toggle: 'tooltip', placement: placement } data: { toggle: 'tooltip', placement: placement }
......
...@@ -271,6 +271,10 @@ describe ApplicationHelper do ...@@ -271,6 +271,10 @@ describe ApplicationHelper do
it 'allows the script tag to be excluded' do it 'allows the script tag to be excluded' do
expect(element(skip_js: true)).not_to include 'script' expect(element(skip_js: true)).not_to include 'script'
end end
it 'converts to Time' do
expect { helper.time_ago_with_tooltip(Date.today) }.not_to raise_error
end
end end
describe 'render_markup' do describe 'render_markup' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment