Commit 97330be9 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch 'format-timeago-date' into 'master'

Formats timeago dates to be more friendly

Closes #27537

See merge request !9145
parents 9f59101f a9c80dce
......@@ -167,7 +167,7 @@ module ApplicationHelper
css_classes = short_format ? 'js-short-timeago' : 'js-timeago'
css_classes << " #{html_class}" unless html_class.blank?
element = content_tag :time, time.to_s,
element = content_tag :time, time.strftime("%b %d, %Y"),
class: css_classes,
title: time.to_time.in_time_zone.to_s(:medium),
datetime: time.to_time.getutc.iso8601,
......
---
title: Format timeago date to short format
merge_request:
author:
......@@ -192,7 +192,7 @@ describe 'Commits' do
commits = project.repository.commits(branch_name)
commits.each do |commit|
expect(page).to have_content("committed #{commit.committed_date}")
expect(page).to have_content("committed #{commit.committed_date.strftime("%b %d, %Y")}")
end
end
end
......
......@@ -193,8 +193,8 @@ describe ApplicationHelper do
describe 'time_ago_with_tooltip' do
def element(*arguments)
Time.zone = 'UTC'
time = Time.zone.parse('2015-07-02 08:23')
element = helper.time_ago_with_tooltip(time, *arguments)
@time = Time.zone.parse('2015-07-02 08:23')
element = helper.time_ago_with_tooltip(@time, *arguments)
Nokogiri::HTML::DocumentFragment.parse(element).first_element_child
end
......@@ -204,7 +204,7 @@ describe ApplicationHelper do
end
it 'includes the date string' do
expect(element.text).to eq '2015-07-02 08:23:00 UTC'
expect(element.text).to eq @time.strftime("%b %d, %Y")
end
it 'has a datetime attribute' 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