summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-03-07 08:12:08 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-03-07 08:12:08 +0000
commitf821eaf7221ca05e86efb49d25ac7e3a236e63f7 (patch)
tree5e2df87496f4f3a5a55f133f1d5a4245e6927e35 /app
parent2800598832d238dcdca3a31da7be940cff8a7d60 (diff)
downloadredmine-f821eaf7221ca05e86efb49d25ac7e3a236e63f7.tar.gz
redmine-f821eaf7221ca05e86efb49d25ac7e3a236e63f7.zip
Adds the date format for ambiguous dates (#19243).
git-svn-id: http://svn.redmine.org/redmine/trunk@14048 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/helpers/settings_helper.rb11
-rw-r--r--app/views/settings/_display.html.erb2
2 files changed, 12 insertions, 1 deletions
diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb
index 778abc795..fcf8ec2e3 100644
--- a/app/helpers/settings_helper.rb
+++ b/app/helpers/settings_helper.rb
@@ -125,4 +125,15 @@ module SettingsHelper
options.map {|label, value| [l(label), value.to_s]}
end
+
+ # Returns the options for the date_format setting
+ def date_format_setting_options(locale)
+ Setting::DATE_FORMATS.map do |f|
+ today = ::I18n.l(Date.today, :locale => locale, :format => f)
+ format = f.gsub('%', '').gsub(/[dmY]/) do
+ {'d' => 'dd', 'm' => 'mm', 'Y' => 'yyyy'}[$&]
+ end
+ ["#{today} (#{format})", f]
+ end
+ end
end
diff --git a/app/views/settings/_display.html.erb b/app/views/settings/_display.html.erb
index ab1ce9b9b..3497f9076 100644
--- a/app/views/settings/_display.html.erb
+++ b/app/views/settings/_display.html.erb
@@ -11,7 +11,7 @@
<p><%= setting_select :start_of_week, [[day_name(1),'1'], [day_name(6),'6'], [day_name(7),'7']], :blank => :label_language_based %></p>
<% locale = User.current.language.blank? ? ::I18n.locale : User.current.language %>
-<p><%= setting_select :date_format, Setting::DATE_FORMATS.collect {|f| [::I18n.l(Date.today, :locale => locale, :format => f), f]}, :blank => :label_language_based %></p>
+<p><%= setting_select :date_format, date_format_setting_options(locale), :blank => :label_language_based %></p>
<p><%= setting_select :time_format, Setting::TIME_FORMATS.collect {|f| [::I18n.l(Time.now, :locale => locale, :format => f), f]}, :blank => :label_language_based %></p>