Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/helpers/application_helper.rb2
-rw-r--r--app/models/global_milestone.rb4
-rw-r--r--app/models/milestone.rb4
-rw-r--r--app/views/admin/groups/show.html.haml2
-rw-r--r--app/views/admin/projects/show.html.haml2
-rw-r--r--app/views/admin/users/_profile.html.haml2
-rw-r--r--app/views/admin/users/show.html.haml8
-rw-r--r--app/views/profiles/keys/_key_details.html.haml2
-rw-r--r--app/views/users/show.html.haml2
-rw-r--r--config/initializers/date_time_formats.rb9
-rw-r--r--spec/helpers/application_helper_spec.rb8
11 files changed, 27 insertions, 18 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index ea0cc3be4b1..2b9bad9c9ea 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -206,7 +206,7 @@ module ApplicationHelper
element = content_tag :time, time.to_s,
class: "#{html_class} js-timeago js-timeago-pending",
datetime: time.getutc.iso8601,
- title: time.in_time_zone.strftime('%b %-d, %Y %-I:%m%P'), # Aug 1, 2011 9:23pm
+ title: time.in_time_zone.to_s(:medium),
data: { toggle: 'tooltip', placement: placement, container: 'body' }
unless skip_js
diff --git a/app/models/global_milestone.rb b/app/models/global_milestone.rb
index 4fa5825a5f3..7ee276255a0 100644
--- a/app/models/global_milestone.rb
+++ b/app/models/global_milestone.rb
@@ -121,9 +121,9 @@ class GlobalMilestone
def expires_at
if due_date
if due_date.past?
- "expired at #{due_date.strftime('%b %-d, %Y')}"
+ "expired on #{due_date.to_s(:medium)}"
else
- "expires at #{due_date.strftime('%b %-d, %Y')}"
+ "expires on #{due_date.to_s(:medium)}"
end
end
end
diff --git a/app/models/milestone.rb b/app/models/milestone.rb
index 5f920132da9..c9a0ad8b9b6 100644
--- a/app/models/milestone.rb
+++ b/app/models/milestone.rb
@@ -112,9 +112,9 @@ class Milestone < ActiveRecord::Base
def expires_at
if due_date
if due_date.past?
- "expired at #{due_date.strftime('%b %-d, %Y')}"
+ "expired on #{due_date.to_s(:medium)}"
else
- "expires at #{due_date.strftime('%b %-d, %Y')}"
+ "expires on #{due_date.to_s(:medium)}"
end
end
end
diff --git a/app/views/admin/groups/show.html.haml b/app/views/admin/groups/show.html.haml
index ef57f51d811..f7fd156b84a 100644
--- a/app/views/admin/groups/show.html.haml
+++ b/app/views/admin/groups/show.html.haml
@@ -30,7 +30,7 @@
%li
%span.light Created on:
%strong
- = @group.created_at.strftime('%B %-d, %Y')
+ = @group.created_at.to_s(:medium)
.panel.panel-default
.panel-heading
diff --git a/app/views/admin/projects/show.html.haml b/app/views/admin/projects/show.html.haml
index 9c3e6ce3214..0c986af4a95 100644
--- a/app/views/admin/projects/show.html.haml
+++ b/app/views/admin/projects/show.html.haml
@@ -38,7 +38,7 @@
%li
%span.light Created on:
%strong
- = @project.created_at.strftime('%B %-d, %Y')
+ = @project.created_at.to_s(:medium)
%li
%span.light http:
diff --git a/app/views/admin/users/_profile.html.haml b/app/views/admin/users/_profile.html.haml
index 26f01c0df04..6bc217f84cc 100644
--- a/app/views/admin/users/_profile.html.haml
+++ b/app/views/admin/users/_profile.html.haml
@@ -4,7 +4,7 @@
%ul.well-list
%li
%span.light Member since
- %strong= user.created_at.strftime('%b %-d, %Y')
+ %strong= user.created_at.to_s(:medium)
- unless user.public_email.blank?
%li
%span.light E-mail:
diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml
index 5d8601c4668..2c2450d4117 100644
--- a/app/views/admin/users/show.html.haml
+++ b/app/views/admin/users/show.html.haml
@@ -58,12 +58,12 @@
%li
%span.light Member since:
%strong
- = @user.created_at.strftime('%b %-d, %Y')
+ = @user.created_at.to_s(:medium)
- if @user.confirmed_at
%li
%span.light Confirmed at:
%strong
- = @user.confirmed_at.strftime('%b %-d, %Y')
+ = @user.confirmed_at.to_s(:medium)
- else
%li
%span.light Confirmed:
@@ -74,7 +74,7 @@
%span.light Current sign-in at:
%strong
- if @user.current_sign_in_at
- = @user.current_sign_in_at.strftime('%b %-d, %Y')
+ = @user.current_sign_in_at.to_s(:medium)
- else
never
@@ -82,7 +82,7 @@
%span.light Last sign-in at:
%strong
- if @user.last_sign_in_at
- = @user.last_sign_in_at.strftime('%b %-d, %Y')
+ = @user.last_sign_in_at.to_s(:medium)
- else
never
diff --git a/app/views/profiles/keys/_key_details.html.haml b/app/views/profiles/keys/_key_details.html.haml
index 35624908e82..3bd1f1af162 100644
--- a/app/views/profiles/keys/_key_details.html.haml
+++ b/app/views/profiles/keys/_key_details.html.haml
@@ -10,7 +10,7 @@
%strong= @key.title
%li
%span.light Created on:
- %strong= @key.created_at.strftime('%b %-d, %Y')
+ %strong= @key.created_at.to_s(:medium)
.col-md-8
%p
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
index 814ba146602..ce17fc7bca1 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -21,7 +21,7 @@
%span
#{@user.bio}.
%span
- Member since #{@user.created_at.strftime('%b %d, %Y')}
+ Member since #{@user.created_at.to_s(:medium)}
.cover-desc
- unless @user.public_email.blank?
diff --git a/config/initializers/date_time_formats.rb b/config/initializers/date_time_formats.rb
new file mode 100644
index 00000000000..57568203cab
--- /dev/null
+++ b/config/initializers/date_time_formats.rb
@@ -0,0 +1,9 @@
+# :short - 10 Nov
+# :medium - Nov 10, 2007
+# :long - November 10, 2007
+Date::DATE_FORMATS[:medium] = '%b %-d, %Y'
+
+# :short - 18 Jan 06:10
+# :medium - Jan 18, 2007 6:10am
+# :long - January 18, 2007 06:10
+Time::DATE_FORMATS[:medium] = '%b %-d, %Y %-I:%M%P'
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index 68527c3a4f8..efc850eb705 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -240,7 +240,7 @@ describe ApplicationHelper do
describe 'time_ago_with_tooltip' do
def element(*arguments)
Time.zone = 'UTC'
- time = Time.zone.parse('2015-07-02 08:00')
+ 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
@@ -251,15 +251,15 @@ describe ApplicationHelper do
end
it 'includes the date string' do
- expect(element.text).to eq '2015-07-02 08:00:00 UTC'
+ expect(element.text).to eq '2015-07-02 08:23:00 UTC'
end
it 'has a datetime attribute' do
- expect(element.attr('datetime')).to eq '2015-07-02T08:00:00Z'
+ expect(element.attr('datetime')).to eq '2015-07-02T08:23:00Z'
end
it 'has a formatted title attribute' do
- expect(element.attr('title')).to eq 'Jul 02, 2015 8:00am'
+ expect(element.attr('title')).to eq 'Jul 2, 2015 8:23am'
end
it 'includes a default js-timeago class' do