diff options
Diffstat (limited to 'app/helpers/settings_helper.rb')
-rw-r--r-- | app/helpers/settings_helper.rb | 11 |
1 files changed, 11 insertions, 0 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 |